@awebai/oats 0.46.0 → 0.48.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/oats.mjs +70 -30
- package/docs/capabilities.md +8 -0
- package/docs/configuration.md +25 -19
- package/docs/desktop-cli-api.md +78 -14
- package/docs/desktop.md +2 -2
- package/docs/execution-targets.md +74 -2
- package/docs/implementation.md +24 -2
- package/docs/launch-prompt-completion.md +70 -0
- package/docs/official-catalog.md +4 -3
- package/docs/packages.md +7 -7
- package/docs/release-notes/v0.47.0.md +93 -0
- package/docs/release-notes/v0.48.0.md +106 -0
- package/docs/souls-and-instances.md +20 -3
- package/docs/workspaces.md +16 -1
- package/lib/core.mjs +48 -7
- package/lib/launch-prompt-completion.mjs +67 -0
- package/lib/launch-prompt-evidence.mjs +159 -0
- package/lib/launch-prompt-fixtures/README.md +72 -4
- package/lib/launch-prompt-fixtures/claude-2.1.289-darwin-arm64/max-bypass-source.json +88 -0
- package/lib/launch-prompt-fixtures/structural-completion.json +205 -0
- package/lib/launch-prompt-fixtures.mjs +14 -3
- package/lib/launch-prompts.mjs +25 -3
- package/lib/teams-verbs.mjs +40 -9
- package/package-catalog.json +11 -4
- package/package.json +1 -1
- package/skills/oats-getting-started/SKILL.md +15 -4
package/lib/teams-verbs.mjs
CHANGED
|
@@ -8,12 +8,14 @@
|
|
|
8
8
|
* `souls:`, edited by a PR to that file: `oats soul teams` only reads them.
|
|
9
9
|
*/
|
|
10
10
|
import { readFileSync } from "node:fs";
|
|
11
|
+
import { join } from "node:path";
|
|
11
12
|
import YAML from "yaml";
|
|
12
13
|
import { parseConfigData } from "./config-data.mjs";
|
|
13
14
|
import { oatsError } from "./errors.mjs";
|
|
14
15
|
import { teamLabelProblem, validateLocal } from "./workspace.mjs";
|
|
15
16
|
import { TEAM_ID_RE, localTeamsClosed, soulTeams, teamModel, teamProblems, teamReferences } from "./teams.mjs";
|
|
16
17
|
import { writeFileAtomic } from "./packages.mjs";
|
|
18
|
+
import { withDirLock } from "./dir-lock.mjs";
|
|
17
19
|
|
|
18
20
|
export const TEAMS_API = 2, SOUL_TEAMS_API = 2;
|
|
19
21
|
const isObject = (v) => v !== null && typeof v === "object" && !Array.isArray(v);
|
|
@@ -99,8 +101,19 @@ function applyState(doc, before, next) {
|
|
|
99
101
|
* `verb` names the command and `writes` the keys it adds, for the refusal where the workspace does not
|
|
100
102
|
* allow local teams (local-teams-closed); a verb that only takes local teams away (`writes: null`) runs
|
|
101
103
|
* there too, since it moves the file toward what the workspace allows. → { changed, local } (the value now).
|
|
104
|
+
* The whole read-compare-write runs under the deployment's local lock (localLock), so among `oats teams`
|
|
105
|
+
* writers the compare and the rename are one step: a conditional write sees every earlier one.
|
|
102
106
|
*/
|
|
103
107
|
function editLocal(ctx, { verb, writes }, mutate) {
|
|
108
|
+
const lock = localLock(ctx);
|
|
109
|
+
return withDirLock(lock, `${verb} on ${ctx.localPath}`, () => editLocalLocked(ctx, { verb, writes }, mutate), {
|
|
110
|
+
retryMs: 5000,
|
|
111
|
+
busy: (why) => fail("E_LOCAL_BUSY", `${ctx.localPath} is being edited by another oats process (the lock ${lock}: ${why}); if no oats teams command is running, remove ${lock} and retry; nothing was written`, { path: ctx.localPath, lock }),
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
/** The lock every `oats teams` mutation holds: in the deployment's kernel state tree, never beside the files. */
|
|
115
|
+
const localLock = (ctx) => join(ctx.deployment, ".agents", "locks", "local.lock");
|
|
116
|
+
function editLocalLocked(ctx, { verb, writes }, mutate) {
|
|
104
117
|
for (let attempt = 0; attempt < 5; attempt++) {
|
|
105
118
|
const { text, doc, local: current } = readLocal(ctx);
|
|
106
119
|
const model = modelOf(ctx, current);
|
|
@@ -128,20 +141,25 @@ const assertLabel = (label) => {
|
|
|
128
141
|
if (problem) throw fail("E_BAD_ARGS", `not a team label (lowercase letters, digits, and . _ - after the first; at most 64 characters): ${problem}`, { label });
|
|
129
142
|
};
|
|
130
143
|
|
|
131
|
-
/** `oats teams add <label> --team <id> [--description <d>]` → { changed, local }.
|
|
132
|
-
|
|
144
|
+
/** `oats teams add <label> --team <id> [--description <d>] [--no-default]` → { changed, local, reused? }.
|
|
145
|
+
* `noDefault`: the mapping only, `defaultTeam` never touched; a mapping already there with the same label
|
|
146
|
+
* and team id (local or shared; the description is not compared) is reuse → { changed: false, reused: true }. */
|
|
147
|
+
export function teamsAdd(ctx, label, { team, description, noDefault = false } = {}) {
|
|
133
148
|
assertLabel(label);
|
|
134
149
|
if (typeof team !== "string" || !team.trim()) throw fail("E_BAD_ARGS", "oats teams add needs --team <provider team id>", { label });
|
|
135
150
|
if (!TEAM_ID_RE.test(team.trim())) throw fail("E_BAD_ARGS", `${JSON.stringify(team)} is not a team id: it must match ${TEAM_ID_RE.source} (a letter or digit first; no whitespace or control characters; at most 256 characters)`, { label, team });
|
|
136
|
-
|
|
151
|
+
let reused = false;
|
|
152
|
+
const result = editLocal(ctx, { verb: "oats teams add", writes: ["teams"] }, (s, model) => {
|
|
137
153
|
if (model.labels.has(label)) {
|
|
138
|
-
const from = model.labels.get(label)
|
|
139
|
-
|
|
154
|
+
const { from, team: existing } = model.labels.get(label);
|
|
155
|
+
if (noDefault && existing === team.trim()) { reused = true; return; }
|
|
156
|
+
throw fail("E_TEAM_EXISTS", `team ${label} is already declared (${from === "shared" ? "shared, in oats-workspace.yaml" : "local, in oats-local.yaml"})${from === "local" ? ": remove it first (`oats teams remove`) to redefine it" : ""}`, { label, from, observed: { label, team: existing, from } });
|
|
140
157
|
}
|
|
141
158
|
s.teams[label] = { team: team.trim(), ...(typeof description === "string" && description ? { description } : {}) };
|
|
142
|
-
// The first team added becomes the deployment's default.
|
|
143
|
-
if (s.defaultTeam === null) s.defaultTeam = label;
|
|
159
|
+
// The first team added becomes the deployment's default (unless --no-default).
|
|
160
|
+
if (s.defaultTeam === null && !noDefault) s.defaultTeam = label;
|
|
144
161
|
});
|
|
162
|
+
return reused ? { ...result, reused } : result;
|
|
145
163
|
}
|
|
146
164
|
|
|
147
165
|
/** `oats teams remove <label>`: a LOCAL team nothing references (no cascade). Allowed where the workspace
|
|
@@ -160,10 +178,23 @@ export function teamsRemove(ctx, label) {
|
|
|
160
178
|
});
|
|
161
179
|
}
|
|
162
180
|
|
|
163
|
-
/**
|
|
164
|
-
|
|
181
|
+
/** Refuse unless the effective default (the `defaultTeam` of `oats teams --json`) is what the caller
|
|
182
|
+
* expects: none (`ifAbsent`), or the label `expect`. Soul defaults are not the deployment's and not looked at. */
|
|
183
|
+
function assertDefaultPrecondition(model, { ifAbsent, expect }) {
|
|
184
|
+
const observed = deploymentDefault(model);
|
|
185
|
+
if (ifAbsent ? observed === null : observed?.label === expect) return;
|
|
186
|
+
const now = observed === null ? "there is no default team" : `the default team is ${observed.label} (${observed.from === "deployment" ? "the deployment's, in oats-local.yaml" : "the workspace's, from oats-workspace.yaml"})`;
|
|
187
|
+
const wanted = ifAbsent ? "--if-absent sets it only where there is none" : `--expect ${expect} sets it only where the default is ${expect}`;
|
|
188
|
+
throw fail("E_TEAM_DEFAULT_MISMATCH", `${now}: ${wanted}; nothing was written`, { expected: ifAbsent ? { absent: true } : { label: expect }, observed });
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
/** `oats teams default <label> [--if-absent | --expect <label0>]`: a label of either file. The condition is
|
|
192
|
+
* judged inside the edit, on the file as it is now (and again on every retry), after today's refusals. */
|
|
193
|
+
export function teamsDefault(ctx, label, { ifAbsent = false, expect } = {}) {
|
|
194
|
+
if (ifAbsent && expect !== undefined) throw fail("E_BAD_ARGS", "oats teams default takes --if-absent or --expect <label>, not both", { label });
|
|
165
195
|
return editLocal(ctx, { verb: "oats teams default", writes: ["defaultTeam"] }, (s, model) => {
|
|
166
196
|
if (!model.labels.has(label)) throw fail("E_TEAM_UNKNOWN", `team ${JSON.stringify(label)} is not declared: \`oats teams add\` it first`, { label });
|
|
197
|
+
if (ifAbsent || expect !== undefined) assertDefaultPrecondition(model, { ifAbsent, expect });
|
|
167
198
|
s.defaultTeam = label;
|
|
168
199
|
});
|
|
169
200
|
}
|
package/package-catalog.json
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
},
|
|
9
9
|
"oats.aweb": {
|
|
10
10
|
"url": "https://github.com/awebai/oats-aweb.git",
|
|
11
|
-
"ref": "v1.
|
|
11
|
+
"ref": "v1.23.2",
|
|
12
12
|
"path": "oats-package"
|
|
13
13
|
},
|
|
14
14
|
"oats.jira": {
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
},
|
|
29
29
|
"oats.engineering": {
|
|
30
30
|
"url": "https://github.com/awebai/oats-engineering.git",
|
|
31
|
-
"ref": "v1.
|
|
31
|
+
"ref": "v1.9.0",
|
|
32
32
|
"path": "oats-package"
|
|
33
33
|
},
|
|
34
34
|
"oats.cloning": {
|
|
@@ -36,9 +36,14 @@
|
|
|
36
36
|
"ref": "v1.0.1",
|
|
37
37
|
"path": "oats-package"
|
|
38
38
|
},
|
|
39
|
+
"oats.apps": {
|
|
40
|
+
"url": "https://github.com/awebai/oats-apps.git",
|
|
41
|
+
"ref": "v1.0.0",
|
|
42
|
+
"path": "oats-package"
|
|
43
|
+
},
|
|
39
44
|
"oats.framework": {
|
|
40
45
|
"url": "https://github.com/awebai/oats.git",
|
|
41
|
-
"ref": "oats-framework/v1.
|
|
46
|
+
"ref": "oats-framework/v1.8.0",
|
|
42
47
|
"path": "oats-package"
|
|
43
48
|
}
|
|
44
49
|
},
|
|
@@ -71,6 +76,8 @@
|
|
|
71
76
|
"oats.engineering-expert": "oats.engineering",
|
|
72
77
|
"oats.developer": "oats.engineering",
|
|
73
78
|
"oats.code-review": "oats.engineering",
|
|
74
|
-
"oats.maintainer": "oats.engineering"
|
|
79
|
+
"oats.maintainer": "oats.engineering",
|
|
80
|
+
"oats.folio": "oats.apps",
|
|
81
|
+
"oats.library": "oats.apps"
|
|
75
82
|
}
|
|
76
83
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@awebai/oats",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.48.0",
|
|
4
4
|
"description": "OATS (Open Agent Team Specification) — durable souls, disposable instances, targetable capability packages, and the runtime-neutral oats CLI/kernel.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"agents",
|
|
@@ -60,7 +60,7 @@ members:
|
|
|
60
60
|
- git:github.com/acme/agents # the host is a member too
|
|
61
61
|
- git:github.com/acme/platform
|
|
62
62
|
packages:
|
|
63
|
-
oats.framework: v1.
|
|
63
|
+
oats.framework: v1.8.0 # bare versions resolve through the official catalog
|
|
64
64
|
oats.okf: v4.1.1
|
|
65
65
|
defaults:
|
|
66
66
|
capabilities: { oats.core: { from: package } }
|
|
@@ -192,11 +192,22 @@ alone is insufficient. Preview reports policy without terminal input;
|
|
|
192
192
|
`--no-launch` never answers. If launch returns `E_SPAWN_INCOMPLETE`, inspect the
|
|
193
193
|
retained home/pane: do not respawn, repeat keys or treat `launched:false` as an
|
|
194
194
|
absent process.
|
|
195
|
-
Completion
|
|
196
|
-
|
|
197
|
-
|
|
195
|
+
Completion retains the exact empty-frame families and, only after the submitted
|
|
196
|
+
channel Enter, can recognize the qualified bottom composer/effort-footer region.
|
|
197
|
+
See [the bounded completion contract](../../docs/launch-prompt-completion.md).
|
|
198
|
+
Known question markers block first; normal shortcut/interrupt hints do not.
|
|
199
|
+
Unknown dialogs retaining that region may be misclassified completed. Completion
|
|
200
|
+
closes input authority, not a readiness or idle-state promise. Missing effort or
|
|
201
|
+
trailing notices still block. Required private evidence failure is incomplete.
|
|
198
202
|
|
|
199
203
|
Create and spawn only when asked. After the first spawn, the `oats.setup`
|
|
200
204
|
skills carry the rest of the deployment (messaging, more souls, rebuilds); the
|
|
201
205
|
`oats.authoring` package teaches writing capabilities, skills and souls. The
|
|
202
206
|
model in full is `docs/workspaces.md` in the OATS repository.
|
|
207
|
+
|
|
208
|
+
For a retained launch-prompt block after a submitted answer, inspect the existing
|
|
209
|
+
launch event and private frame receipt as described in
|
|
210
|
+
`docs/execution-targets.md#private-unmatched-launch-evidence`. Do not transmit raw
|
|
211
|
+
screen text or treat a saved frame as a new accepted signature. A structurally completed frame is also saved privately. A saved artifact alone
|
|
212
|
+
does not establish completion: verify the final checked launch outcome. Missing
|
|
213
|
+
effort or unsupported footer shapes can block while the pane is active.
|