Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 1 addition & 47 deletions .agent/agents.resolved
Original file line number Diff line number Diff line change
@@ -1,47 +1 @@
{
"instructions": {
"chatgpt": {},
"sections": [
{
"hash": "sha256:b954b104c6cf0639214a105a846d4fc8e73fd55f14eb695f407f942b905bf22e",
"name": "guide",
"path": ".agent/instructions/guide.md",
"source": "."
},
{
"hash": "sha256:a45b15d662eecec4b252fa2e35a608bab0ee137fae525669097f45d0f8c3f39d",
"name": "shared/swift-package-route",
"path": ".agent/instructions/shared/swift-package-route.md",
"revision": "fc8a2fc1b9d5dcea39788d0c70cd35dded2673ea",
"source": "github.com/agents-tools/.github"
},
{
"hash": "sha256:5d9f40d101938d2805482b9a147397bc07e9c3c9223cfe040f0905cb6c746825",
"name": "shared/swift-package-tests",
"path": ".agent/instructions/shared/swift-package-tests.md",
"revision": "fc8a2fc1b9d5dcea39788d0c70cd35dded2673ea",
"source": "github.com/agents-tools/.github"
}
],
"targets": {
"AGENTS.md": {
"agents": ["claude-code", "codex"],
"blockHash": "sha256:a025a4ce7d403ace72e30ffe5b2922f571c44f0f6ea52998f5a1bfe6a7ee3fd6",
"created": false,
"headingOffset": 0
}
}
},
"skills": {},
"sources": {
"github.com/agents-tools/.github": {
"kind": "git",
"path": ".agent",
"requirement": {
"branch": "master"
},
"url": "https://github.com/agents-tools/.github"
}
},
"version": 1
}
{"components":{"sha256:3c1ea5baf10fa99ee7576e64c3256b78f4bd9aeb99441b32f6431dfa0e129274":{"chatGPT":false,"conditions":[{}],"declaringSource":"sha256:d20f3fcaba358dcbae462caf58d6393127b61d91f2ba3197b0f84a019dd0e9d8","kind":"instructions","name":"guide","payload":{"kind":"object","object":{"name":{"kind":"string","text":"guide"},"native":{"kind":"object","object":{}},"sourceHash":{"kind":"string","text":"sha256:b954b104c6cf0639214a105a846d4fc8e73fd55f14eb695f407f942b905bf22e"}}},"recipients":["claude-code","codex"],"resources":["sha256:5011da2b72050c86a0f02bcfc069913fa95d30f5b20bf44a55496494424caa97"],"root":".","source":"sha256:d20f3fcaba358dcbae462caf58d6393127b61d91f2ba3197b0f84a019dd0e9d8"},"sha256:754407554f06d2e1ae23a32c4e2bc39d16781cf468fed1a48e35def4f0836426":{"chatGPT":false,"conditions":[{}],"declaringSource":"sha256:d20f3fcaba358dcbae462caf58d6393127b61d91f2ba3197b0f84a019dd0e9d8","kind":"instructions","name":"shared/swift-package-route","payload":{"kind":"object","object":{"name":{"kind":"string","text":"shared/swift-package-route"},"native":{"kind":"object","object":{}},"sourceHash":{"kind":"string","text":"sha256:a45b15d662eecec4b252fa2e35a608bab0ee137fae525669097f45d0f8c3f39d"}}},"recipients":["claude-code","codex"],"resources":["sha256:cb6aea4e7350afe57cdb7729e9b9daabf33eae2286d59f5314a0ae605f29c9f3"],"revision":"fc8a2fc1b9d5dcea39788d0c70cd35dded2673ea","root":".","source":"sha256:106e5eaca24fac766d77fa1b5b2cad5b4fdf537929ed086f49e2142f702329a6"},"sha256:e4a73605a9830d1c8804aebf5558b8c0c2af26fa405ce5b6591d91c943db5d16":{"chatGPT":false,"conditions":[{}],"declaringSource":"sha256:d20f3fcaba358dcbae462caf58d6393127b61d91f2ba3197b0f84a019dd0e9d8","kind":"instructions","name":"shared/swift-package-tests","payload":{"kind":"object","object":{"name":{"kind":"string","text":"shared/swift-package-tests"},"native":{"kind":"object","object":{}},"sourceHash":{"kind":"string","text":"sha256:5d9f40d101938d2805482b9a147397bc07e9c3c9223cfe040f0905cb6c746825"}}},"recipients":["claude-code","codex"],"resources":["sha256:3e6e83f98fceb7ee2f89a4e7e6eac3a396d02b1c8341f6ec516e1f230e2c2a11"],"revision":"fc8a2fc1b9d5dcea39788d0c70cd35dded2673ea","root":".","source":"sha256:106e5eaca24fac766d77fa1b5b2cad5b4fdf537929ed086f49e2142f702329a6"}},"contentObjects":{"s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V0IG5hbWVzIHVubGVzcyB0aGUgcGFja2FnZQogIGJvdW5kYXJ5IHN0b3BzIG1ha2luZyB0aGF0IGNvbnRleHQgY2xlYXIuCi0gRGlzYWJsZSBhdXRvbWF0aWMgbWFpbnRlbmFuY2UgYW5kIGdjIGluIGZpeHR1cmUgR2l0IHJlcG9zaXRvcmllcy4K"},"deployments":[{"created":false,"expectedHash":"sha256:a025a4ce7d403ace72e30ffe5b2922f571c44f0f6ea52998f5a1bfe6a7ee3fd6","headingOffset":0,"id":"instructions:AGENTS.md","owners":["sha256:3c1ea5baf10fa99ee7576e64c3256b78f4bd9aeb99441b32f6431dfa0e129274","sha256:754407554f06d2e1ae23a32c4e2bc39d16781cf468fed1a48e35def4f0836426","sha256:e4a73605a9830d1c8804aebf5558b8c0c2af26fa405ce5b6591d91c943db5d16"],"ownership":"generated","recipients":["claude-code","codex"],"route":"agents/instructions@1","target":{"kind":"registered","path":"AGENTS.md","root":"project"}}],"groups":[],"lowerings":[{"artifacts":[{"hash":"sha256:a025a4ce7d403ace72e30ffe5b2922f571c44f0f6ea52998f5a1bfe6a7ee3fd6","kind":"file","name":"instructions:AGENTS.md"}],"deployments":["instructions:AGENTS.md"],"format":"agents/instructions@1","id":"instructions:AGENTS.md","inputs":["sha256:3c1ea5baf10fa99ee7576e64c3256b78f4bd9aeb99441b32f6431dfa0e129274","sha256:754407554f06d2e1ae23a32c4e2bc39d16781cf468fed1a48e35def4f0836426","sha256:e4a73605a9830d1c8804aebf5558b8c0c2af26fa405ce5b6591d91c943db5d16"],"layout":{"kind":"object","object":{"headingOffset":{"integer":0,"kind":"integer"},"name":{"kind":"string","text":"instructions:AGENTS.md"}}},"platform":"macos","resources":["sha256:5011da2b72050c86a0f02bcfc069913fa95d30f5b20bf44a55496494424caa97","sha256:cb6aea4e7350afe57cdb7729e9b9daabf33eae2286d59f5314a0ae605f29c9f3","sha256:3e6e83f98fceb7ee2f89a4e7e6eac3a396d02b1c8341f6ec516e1f230e2c2a11"]}],"occurrences":[{"component":"sha256:3c1ea5baf10fa99ee7576e64c3256b78f4bd9aeb99441b32f6431dfa0e129274","condition":{},"consumerEditable":true,"declaringSource":"sha256:d20f3fcaba358dcbae462caf58d6393127b61d91f2ba3197b0f84a019dd0e9d8","dependencies":["sha256:d20f3fcaba358dcbae462caf58d6393127b61d91f2ba3197b0f84a019dd0e9d8"],"id":0,"manifestPath":".agent/agents.yaml","recipients":["claude-code","codex"]},{"component":"sha256:754407554f06d2e1ae23a32c4e2bc39d16781cf468fed1a48e35def4f0836426","condition":{},"consumerEditable":true,"declaringSource":"sha256:d20f3fcaba358dcbae462caf58d6393127b61d91f2ba3197b0f84a019dd0e9d8","dependencies":["sha256:106e5eaca24fac766d77fa1b5b2cad5b4fdf537929ed086f49e2142f702329a6"],"id":1,"manifestPath":".agent/agents.yaml","recipients":["claude-code","codex"]},{"component":"sha256:e4a73605a9830d1c8804aebf5558b8c0c2af26fa405ce5b6591d91c943db5d16","condition":{},"consumerEditable":true,"declaringSource":"sha256:d20f3fcaba358dcbae462caf58d6393127b61d91f2ba3197b0f84a019dd0e9d8","dependencies":["sha256:106e5eaca24fac766d77fa1b5b2cad5b4fdf537929ed086f49e2142f702329a6"],"id":2,"manifestPath":".agent/agents.yaml","recipients":["claude-code","codex"]}],"resources":{"sha256:3e6e83f98fceb7ee2f89a4e7e6eac3a396d02b1c8341f6ec516e1f230e2c2a11":{"entries":[{"byteCount":421,"executable":false,"kind":"file","path":"."}],"hash":"sha256:5d9f40d101938d2805482b9a147397bc07e9c3c9223cfe040f0905cb6c746825","kind":"git","path":".agent/instructions/shared/swift-package-tests.md","source":"sha256:106e5eaca24fac766d77fa1b5b2cad5b4fdf537929ed086f49e2142f702329a6","support":[]},"sha256:5011da2b72050c86a0f02bcfc069913fa95d30f5b20bf44a55496494424caa97":{"entries":[{"byteCount":903,"executable":false,"kind":"file","object":"sha256:b954b104c6cf0639214a105a846d4fc8e73fd55f14eb695f407f942b905bf22e","path":"."}],"hash":"sha256:b954b104c6cf0639214a105a846d4fc8e73fd55f14eb695f407f942b905bf22e","kind":"embedded","path":".agent/instructions/guide.md","source":"sha256:d20f3fcaba358dcbae462caf58d6393127b61d91f2ba3197b0f84a019dd0e9d8","support":[]},"sha256:cb6aea4e7350afe57cdb7729e9b9daabf33eae2286d59f5314a0ae605f29c9f3":{"entries":[{"byteCount":1077,"executable":false,"kind":"file","path":"."}],"hash":"sha256:a45b15d662eecec4b252fa2e35a608bab0ee137fae525669097f45d0f8c3f39d","kind":"git","path":".agent/instructions/shared/swift-package-route.md","source":"sha256:106e5eaca24fac766d77fa1b5b2cad5b4fdf537929ed086f49e2142f702329a6","support":[]}},"sourceUses":[{"requirement":{"branch":"master"},"root":".agent","source":"sha256:106e5eaca24fac766d77fa1b5b2cad5b4fdf537929ed086f49e2142f702329a6"}],"sources":{"sha256:106e5eaca24fac766d77fa1b5b2cad5b4fdf537929ed086f49e2142f702329a6":{"kind":"git","revision":"fc8a2fc1b9d5dcea39788d0c70cd35dded2673ea","transport":"https://github.com/agents-tools/.github"},"sha256:d20f3fcaba358dcbae462caf58d6393127b61d91f2ba3197b0f84a019dd0e9d8":{"kind":"local","location":{"kind":"registered","path":".","root":"project"},"revision":"live"}},"version":2}
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,23 @@ publication follows the [release checklist](Documentation/Reference/Release.md).

## Unreleased

## 0.3.1

### Fixed

- Swift packages can depend on Core by semantic version. Core uses the published
MCP Swift SDK 0.12.1 release.
- Cancelled lifecycle commands have time to finish their termination handlers.
Subprocess cleanup reports success when the owned process group has stopped
and its leader has been reaped within the cleanup deadline.

### Removed

- Removed `ExistingGlobalConfiguration`, which converted user `agents.json`
declarations and version 1 locks. Finish any pending conversion with the
version that started it before upgrading. Declare user configuration in
`~/.agents/agents.yaml` and use the standard preview and apply flow.

## 0.3.0

### Added
Expand Down
5 changes: 3 additions & 2 deletions Package.resolved

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 1 addition & 3 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@ let package = Package(
.library(name: "AgentsUpdates", targets: ["AgentsUpdates"]),
],
dependencies: [
.package(
url: "https://github.com/modelcontextprotocol/swift-sdk.git",
revision: "a0ae212ebf6eab5f754c3129608bc5557637e605"),
.package(url: "https://github.com/modelcontextprotocol/swift-sdk.git", exact: "0.12.1"),
.package(url: "https://github.com/apple/swift-crypto.git", from: "5.0.0"),
.package(url: "https://github.com/jpsim/Yams", exact: "6.2.2"),
.package(url: "https://github.com/swiftlang/swift-markdown.git", from: "0.9.0"),
Expand Down
28 changes: 3 additions & 25 deletions Sources/AgentsCore/FileTransaction.swift
Original file line number Diff line number Diff line change
Expand Up @@ -497,26 +497,6 @@ package final class FileTransaction {
throw CoreError.invalidState("transaction recovery is required")
}
try queueReceipt()
let paths = Set(requests.map(\.path))
let originalLedger = "state/" + StateStore.originalLedgerFileName
let importingConfiguration = paths.contains(originalLedger)
if importingConfiguration {
guard
paths == [
originalLedger, "state/" + StateStore.declarationFileName,
"state/" + StateStore.resolvedFileName,
], requests.count == 3, requests.allSatisfy(\.installs),
requests.first(where: { $0.path == originalLedger })?.evidence.exists == false,
requests.first(where: { $0.path == "state/" + StateStore.declarationFileName })?
.evidence.exists == false,
requests.first(where: { $0.path == "state/" + StateStore.resolvedFileName })?
.evidence.exists == true
else {
throw CoreError.invalidState(
"configuration import requires the declaration, resolved ledger, and original ledger copy"
)
}
}
for state in receiptStates.values { try state.evidence.validate() }
try validateUnchanged()
for request in requests { try request.evidence.validate() }
Expand All @@ -530,11 +510,9 @@ package final class FileTransaction {
try session.createContainers()
try session.checkCapabilities()
// Capability probing may only touch missing ancestry, journal and private containers.
if !importingConfiguration,
session.journal.entries.contains(where: {
["state/agents.watch", "state/agents.resolved"].contains($0.path)
})
{
if session.journal.entries.contains(where: {
["state/agents.watch", "state/agents.resolved"].contains($0.path)
}) {
try SourceCache(store: store, checkpoint: checkpoint).beginWatchReferenceUpdate()
}
for (index, request) in requests.enumerated() {
Expand Down
2 changes: 1 addition & 1 deletion Sources/AgentsCore/LedgerStateStore.swift
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ extension StateStore {
}, expecting: prepared.evidence(for: resolvedURL))
}

private func ledgerBytes(limits: LedgerLimits) throws -> Data? {
package func ledgerBytes(limits: LedgerLimits) throws -> Data? {
guard let directory = try openDirectoryIfPresent(),
try directory.info(Self.resolvedFileName) != nil
else { return nil }
Expand Down
4 changes: 2 additions & 2 deletions Sources/AgentsCore/NativeTargetCoordination.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1163,7 +1163,7 @@ extension StateStore {
routes: Set<NativeTargetRoute>, installations: [SkillInstallationTarget] = [], writable: Bool,
checkpoint: (String) throws -> Void = { _ in },
existingRoot: ExistingProjectRoot? = nil, projectRoot: DirectoryHandle? = nil,
onReadLocation: ((URL) -> Void)? = nil, admitRecovery: Bool = true,
onReadLocation: ((URL) -> Void)? = nil,
_ body: () throws -> T
) throws -> T {
func recordAncestry(_ url: URL) {
Expand Down Expand Up @@ -1198,7 +1198,7 @@ extension StateStore {
}
for route in routes where !route.shared && route.isNamed { _ = try nativeTarget(for: route) }
while true {
let before = try admitRecovery ? pendingCoordinationJournal(diagnosing: !writable) : nil
let before = try pendingCoordinationJournal(diagnosing: !writable)
var resources: [SharedResource] = []
var createdAncestry: [(URL, DirectoryAccessEvidence)] = []
if writable {
Expand Down
41 changes: 23 additions & 18 deletions Sources/AgentsCore/OwnedDuplexProcess.swift
Original file line number Diff line number Diff line change
Expand Up @@ -166,15 +166,15 @@ package final class OwnedDuplexProcess: @unchecked Sendable {
}
}

private func signalGroup(_ signal: Int32) -> Bool {
private func signalGroup(_ signal: Int32) {
lock.withLock {
guard owned && !reaped else { return false }
guard owned && !reaped else { return }
var exited = false
guard platform_duplex_observe(identifier, &exited) == 0 else {
owned = false
return false
return
}
return platform_duplex_signal(identifier, signal) == 0
_ = platform_duplex_signal(identifier, signal)
}
}

Expand Down Expand Up @@ -224,20 +224,25 @@ package final class OwnedDuplexProcess: @unchecked Sendable {
/// members remain or the cleanup deadline fails. False means the
/// kernel did not confirm cleanup; callers must not report complete success.
package func finish(grace: Duration, terminate: Duration, killWait: Duration) async -> Bool {
closeInput()
try? await Task.sleep(for: grace)
let term = signalGroup(SIGTERM)
try? await Task.sleep(for: terminate)
let killed = signalGroup(SIGKILL)
closeOutput()
let deadline = ContinuousClock.now + killWait
repeat {
if reapIfExited() { return ContinuousClock.now <= deadline && term && killed }
try? await Task.sleep(for: .milliseconds(2))
} while ContinuousClock.now < deadline
// No further group signals follow release of the reserved identity.
_ = reapIfExited(requireQuiescence: false)
return false
// Keep the cleanup waits independent of caller cancellation.
let cleanup = Task {
closeInput()
try? await Task.sleep(for: grace)
signalGroup(SIGTERM)
try? await Task.sleep(for: terminate)
signalGroup(SIGKILL)
closeOutput()
let deadline = ContinuousClock.now + killWait
repeat {
// Quiescence and reap confirm cleanup even if a signal attempt failed.
if reapIfExited() { return ContinuousClock.now <= deadline }
try? await Task.sleep(for: .milliseconds(2))
} while ContinuousClock.now < deadline
// No further group signals follow release of the reserved identity.
_ = reapIfExited(requireQuiescence: false)
return false
}
return await cleanup.value
}

deinit {
Expand Down
25 changes: 0 additions & 25 deletions Sources/AgentsCore/ResolvedState.swift
Original file line number Diff line number Diff line change
Expand Up @@ -302,31 +302,6 @@ public struct ResolvedState: Codable, Equatable, Sendable {
else { throw CoreError.invalidState("Git item needs an exact revision and path") }
}
}

package var normalized: ResolvedState {
var result = self
for id in result.sources.keys {
let requirement = result.sources[id]?.requirement?.canonical
result.sources[id]?.requirement = requirement
}
for name in result.skills.keys {
result.skills[name]?.artifact?.files?.sort { $0.path < $1.path }
}
for index in result.instructions.sections.indices {
result.instructions.sections[index].artifact?.files?.sort { $0.path < $1.path }
}
for name in result.instructions.chatgpt.keys {
guard var prompt = result.instructions.chatgpt[name] else { continue }
for index in prompt.sections.indices {
prompt.sections[index].artifact?.files?.sort { $0.path < $1.path }
}
result.instructions.chatgpt[name] = prompt
}
for path in result.instructions.targets.keys {
result.instructions.targets[path]?.agents.sort { $0.rawValue < $1.rawValue }
}
return result
}
}

package enum StateValidation {
Expand Down
2 changes: 1 addition & 1 deletion Sources/AgentsCore/SourceRequirement.swift
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public enum SourceRequirement: Codable, Equatable, Sendable {
self = requirement
}

package static func decodeIfPresent(from decoder: Decoder) throws -> SourceRequirement? {
private static func decodeIfPresent(from decoder: Decoder) throws -> SourceRequirement? {
let container = try decoder.container(keyedBy: CodingKeys.self)
let keys: [CodingKeys] = [.branch, .revision, .exact, .from, .upToNextMinor]
let present = keys.filter { container.contains($0) }
Expand Down
17 changes: 0 additions & 17 deletions Sources/AgentsCore/StateInspection.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,6 @@ extension StateStore {
try context.requireHeldScope()
}

package var configurationJSONURL: URL? {
scope == .user ? directory.appendingPathComponent(Self.configurationJSONFileName) : nil
}

package func stateEntryExists(_ name: String) throws -> Bool {
try openDirectoryIfPresent()?.info(name) != nil
}

package func configurationInputBytes(_ name: String) throws -> Data? {
guard let directory = try openDirectoryIfPresent(),
try directory.info(name) != nil
else { return nil }
return try directory.read(name, maximumBytes: LedgerLimits.standard.encodedBytes)
}

/// Metadata and admission entries, including absent paths. Only the supplied scope root
/// resolves through links; state-directory and lock links do not grant new path authority.
package var metadataReadLocations: [URL] {
Expand All @@ -38,8 +23,6 @@ extension StateStore {
TransactionJournal.fileName, TransactionJournal.incompleteFileName,
"watch-refs.pending",
].map { directory.appendingPathComponent($0) }
+ (scope == .user
? [directory.appendingPathComponent(Self.configurationJSONFileName)] : [])
}
}

Expand Down
Loading
Loading