@ours.network/fleet 2.4.3 → 2.5.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/README.md +29 -32
- package/contrib/.claude-plugin/marketplace.json +1 -1
- package/contrib/claude-native/hooks/register.js +108 -31
- package/dist/agent-ours/mcp-endpoint.d.ts +3 -0
- package/dist/agent-ours/mcp-endpoint.js +3 -0
- package/dist/agent-ours/service.d.ts +3 -0
- package/dist/agent-ours/service.js +19 -2
- package/dist/application/conversation-history.js +2 -2
- package/dist/application/fleet-query-service.js +6 -3
- package/dist/application/native-claude-conversation.js +13 -2
- package/dist/application/native-conversation.d.ts +5 -0
- package/dist/application/native-conversation.js +30 -5
- package/dist/application/native-conversations.d.ts +3 -0
- package/dist/application/native-conversations.js +2 -0
- package/dist/application/role-creation-service.js +0 -3
- package/dist/application/session-control.d.ts +3 -0
- package/dist/application/session-control.js +5 -0
- package/dist/application/types.d.ts +5 -0
- package/dist/build-info.json +4 -4
- package/dist/cli.js +2 -3
- package/dist/config.d.ts +9 -2
- package/dist/config.js +15 -4
- package/dist/docs.d.ts +5 -7
- package/dist/docs.js +38 -46
- package/dist/doctor.js +4 -6
- package/dist/file-delivery/store.d.ts +12 -0
- package/dist/file-delivery/store.js +24 -2
- package/dist/fleet-command-audit.js +3 -2
- package/dist/fleet-proxy.js +0 -1
- package/dist/harness/hermes-permissions.js +1 -1
- package/dist/harness/hermes-session.js +0 -1
- package/dist/init-wizard.js +2 -2
- package/dist/lifecycle-summary.d.ts +3 -2
- package/dist/lifecycle-summary.js +2 -3
- package/dist/native-participation-cli.js +55 -10
- package/dist/native-participation.d.ts +174 -0
- package/dist/native-participation.js +67 -0
- package/dist/notifications/status-producer.d.ts +37 -0
- package/dist/notifications/status-producer.js +146 -0
- package/dist/permissions.d.ts +2 -3
- package/dist/permissions.js +3 -3
- package/dist/preset-migration.js +12 -0
- package/dist/rooms-tasks/cli.js +2 -6
- package/dist/rooms-tasks/deletion.js +3 -0
- package/dist/rooms-tasks/member-overrides.d.ts +2 -1
- package/dist/rooms-tasks/member-overrides.js +1 -4
- package/dist/rooms-tasks/task-contributions.d.ts +15 -0
- package/dist/rooms-tasks/task-contributions.js +13 -2
- package/dist/runner.js +24 -8
- package/dist/session/acp.d.ts +9 -29
- package/dist/session/acp.js +31 -308
- package/dist/session/codex-app-server.d.ts +9 -6
- package/dist/session/codex-app-server.js +19 -58
- package/dist/session/control.d.ts +5 -0
- package/dist/session/control.js +19 -3
- package/dist/session/conversation-types.d.ts +3 -2
- package/dist/session/status-notice.d.ts +24 -0
- package/dist/session/status-notice.js +38 -0
- package/dist/session/types.d.ts +2 -0
- package/dist/spawn.d.ts +1 -2
- package/dist/spawn.js +2 -6
- package/dist/statuses/permission-projection.d.ts +53 -0
- package/dist/statuses/permission-projection.js +317 -0
- package/dist/statuses/status-answers.d.ts +31 -0
- package/dist/statuses/status-answers.js +85 -0
- package/dist/statuses/status-feed.d.ts +85 -0
- package/dist/statuses/status-feed.js +122 -0
- package/dist/statuses/status-kinds.d.ts +15 -0
- package/dist/statuses/status-kinds.js +12 -0
- package/dist/statuses/status-ledger.d.ts +21 -0
- package/dist/statuses/status-ledger.js +80 -0
- package/dist/statuses/status-routes.d.ts +43 -0
- package/dist/statuses/status-routes.js +140 -0
- package/dist/statuses/status-store.d.ts +257 -0
- package/dist/statuses/status-store.js +605 -0
- package/dist/statuses/status-tools.d.ts +21 -0
- package/dist/statuses/status-tools.js +126 -0
- package/dist/supervisor/manager.js +11 -0
- package/dist/web/resource-views.d.ts +3 -1
- package/dist/web/resource-views.js +6 -2
- package/dist/web/runtime.js +21 -0
- package/dist/web/server.js +15 -0
- package/docs/acp-files.md +9 -7
- package/docs/native-session-participation.md +14 -0
- package/docs/validation/managed-cli-permissions.md +1 -1
- package/examples/fleet/agents/Alice.yaml +1 -1
- package/examples/fleet/agents/FleetCoordinator.yaml +1 -1
- package/examples/fleet.yaml +0 -1
- package/package.json +2 -2
- package/presets/fleet/agent_templates/Critic.yaml +1 -1
- package/presets/fleet/agent_templates/Developer.yaml +1 -1
- package/presets/fleet/agent_templates/Engineer.yaml +1 -1
- package/presets/fleet/agent_templates/LocalCoordinator.yaml +1 -1
- package/presets/fleet/agents/FleetCoordinator.yaml +1 -1
- package/presets/fleet.yaml +1 -1
- package/presets/manifest.json +1 -1
package/dist/docs.js
CHANGED
|
@@ -226,7 +226,7 @@ ours-fleet spawn [--temp] [Name | --name Name] \\
|
|
|
226
226
|
--cwd /absolute/path --identity Identity --coordinator Coordinator \\
|
|
227
227
|
--approval ask|auto|allow \\
|
|
228
228
|
--filesystem read-only|workspace|unrestricted \\
|
|
229
|
-
--
|
|
229
|
+
--isolation-file /path/isolation.yaml
|
|
230
230
|
\`\`\`
|
|
231
231
|
|
|
232
232
|
Permanent spawn writes \`~/fleet/agents/Name.yaml\` and starts a supervised role.
|
|
@@ -281,7 +281,7 @@ role's name or persona and is not inherited by agents it spawns:
|
|
|
281
281
|
# fleet/agents/FleetCoordinator.yaml
|
|
282
282
|
role: { ref: Coordinator }
|
|
283
283
|
brain: { ref: codex-gpt-5-4-medium }
|
|
284
|
-
permissions: { approval: auto, filesystem: workspace
|
|
284
|
+
permissions: { approval: auto, filesystem: workspace }
|
|
285
285
|
managed_cli: [task-workflow]
|
|
286
286
|
\`\`\`
|
|
287
287
|
|
|
@@ -400,7 +400,6 @@ defaults:
|
|
|
400
400
|
permissions:
|
|
401
401
|
approval: ask
|
|
402
402
|
filesystem: workspace
|
|
403
|
-
unattended: deny
|
|
404
403
|
monitor:
|
|
405
404
|
mode: fleet # fleet (default) | native
|
|
406
405
|
watchdogs:
|
|
@@ -921,8 +920,13 @@ Prefer the harness-neutral \`permissions\` block:
|
|
|
921
920
|
- \`approval: ask|auto|allow\`: portable permission policy. \`deny\` remains a
|
|
922
921
|
deprecated, fail-closed compatibility alias for existing fleet files.
|
|
923
922
|
- \`filesystem: read-only|workspace|unrestricted\`: filesystem intent
|
|
924
|
-
|
|
925
|
-
|
|
923
|
+
|
|
924
|
+
Every permission request a harness raises waits for the Owner's answer, in the
|
|
925
|
+
agent's session or in the feed, with no timeout and no automatic denial, whether
|
|
926
|
+
or not a console is attached. It ends without an answer only when its turn or
|
|
927
|
+
session really ends (cancelled, closed, exited, or withdrawn by the harness). The
|
|
928
|
+
retired \`unattended\` key is still accepted and ignored, with one startup
|
|
929
|
+
warning naming the role.
|
|
926
930
|
|
|
927
931
|
The backend translates this common intent. Native Codex app-server roles reject
|
|
928
932
|
permission aliases in \`harness_options\`; Codex ACP and Claude retain their
|
|
@@ -954,37 +958,31 @@ directory, no identity reservation. Works for both permanent and \`--temp\` role
|
|
|
954
958
|
|
|
955
959
|
The failure this section exists to prevent leaves no error message anywhere.
|
|
956
960
|
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
\`~/.ours-fleet/agents/<Name>/.session-events.jsonl\`
|
|
971
|
-
|
|
972
|
-
(\`permissions.unattended=deny\` vs \`permissions.approval=deny\`/\`=allow\`),
|
|
973
|
-
the reason, and the option selected. \`ours-fleet peek\` and \`attach\` render
|
|
974
|
-
them. Automatic denial asks for a one-shot rejection, never a standing one, so a
|
|
975
|
-
single unattended refusal cannot disable a tool for the rest of the session.
|
|
976
|
-
|
|
977
|
-
A role that can auto-deny logs one line at startup saying so.
|
|
961
|
+
A permission mode that suppresses the prompt without granting the action (Claude
|
|
962
|
+
\`dontAsk\`, which is why neutral \`allow\` maps to \`bypassPermissions\`
|
|
963
|
+
instead) refuses the request INSIDE the harness — no prompt, no error, no log
|
|
964
|
+
line. The agent simply does less than its briefing told it to, reports success,
|
|
965
|
+
and nothing distinguishes that from having done the work.
|
|
966
|
+
|
|
967
|
+
Every other request reaches Fleet and waits for the Owner (session or feed).
|
|
968
|
+
**Fleet never decides a raised request.** \`permissions.approval\` only selects
|
|
969
|
+
the harness's native mode, which decides whether a request is raised at all;
|
|
970
|
+
once raised, it waits — under every \`approval\` value, the deprecated
|
|
971
|
+
\`deny\` alias included. A request ends without the Owner's answer only when
|
|
972
|
+
its turn or session really ends or the harness withdraws it; that ending is
|
|
973
|
+
recorded as cancelled, never as an approval or a denial, in
|
|
974
|
+
\`~/.ours-fleet/agents/<Name>/.session-events.jsonl\` with the reason.
|
|
975
|
+
\`ours-fleet peek\` and \`attach\` render every decision and ending.
|
|
978
976
|
|
|
979
977
|
To detect an under-permissioned role BEFORE it runs, use the capability floor
|
|
980
|
-
below: \`ours-fleet doctor\`
|
|
981
|
-
|
|
978
|
+
below: \`ours-fleet doctor\` warns about such a role, whose requests would each
|
|
979
|
+
wait for the Owner.
|
|
982
980
|
|
|
983
981
|
### The unattended capability floor
|
|
984
982
|
|
|
985
|
-
An
|
|
986
|
-
|
|
987
|
-
|
|
983
|
+
An agent working alone needs its briefing's own actions to be granted natively;
|
|
984
|
+
otherwise each one raises a permission request that waits for the Owner's
|
|
985
|
+
answer and the agent makes no progress meanwhile. To make that visible before launch,
|
|
988
986
|
\`ours-fleet config\` and \`ours-fleet doctor\` resolve each role's neutral
|
|
989
987
|
permissions through its harness and check the result against a fixed floor:
|
|
990
988
|
|
|
@@ -995,10 +993,8 @@ permissions through its harness and check the result against a fixed floor:
|
|
|
995
993
|
- \`workspace-edit\` — edit and test files in its working directory
|
|
996
994
|
- \`status-commands\` — run the inspection commands its briefing prescribes
|
|
997
995
|
|
|
998
|
-
\`doctor\` reports this per role as \`unattended floor: <Role>\`. A role
|
|
999
|
-
|
|
1000
|
-
deny those requests with nobody to see it; with \`unattended: wait\` it warns,
|
|
1001
|
-
because a human can still attach and answer.
|
|
996
|
+
\`doctor\` reports this per role as \`unattended floor: <Role>\`. A role that
|
|
997
|
+
cannot meet the floor warns: those requests will wait for the Owner's answer.
|
|
1002
998
|
|
|
1003
999
|
Security meaning: native Codex maps \`ask\` → \`untrusted\`, \`auto\` →
|
|
1004
1000
|
\`on-request\`, and \`allow\` → \`never\`; its independent filesystem mapping is
|
|
@@ -1028,7 +1024,7 @@ still wins, as does an explicit native approval override. \`config\` and
|
|
|
1028
1024
|
\`isolation:\` as the outer boundary for an \`allow\` ACP role. The live session
|
|
1029
1025
|
reports both its effective normalized mode and the exact native mode selected.
|
|
1030
1026
|
|
|
1031
|
-
See also: \`spawn --approval/--filesystem
|
|
1027
|
+
See also: \`spawn --approval/--filesystem\` set this intent at
|
|
1032
1028
|
creation, and \`ours-fleet config\` prints each role's neutral settings, their
|
|
1033
1029
|
native translation, and any warning — the same text \`doctor\` reports.
|
|
1034
1030
|
|
|
@@ -1498,10 +1494,8 @@ reconcile explicitly; no chain preserves detection-only behavior.
|
|
|
1498
1494
|
*
|
|
1499
1495
|
* \`forbidden\` is the more important half. The old skills prescribed
|
|
1500
1496
|
* \`--approval ask --filesystem workspace --unattended deny\` as a blanket
|
|
1501
|
-
* default
|
|
1502
|
-
*
|
|
1503
|
-
* guarantee unattended capabilities and \`deny\` makes the shortfall
|
|
1504
|
-
* fatal. Following the skill produced a role the CLI then refused.
|
|
1497
|
+
* default; \`--unattended\` is retired (every permission request waits for the
|
|
1498
|
+
* Owner), so no variant may print it.
|
|
1505
1499
|
*/
|
|
1506
1500
|
export const SPAWN_SKILL_CONTRACT = {
|
|
1507
1501
|
/** Substrings every variant must contain (whitespace-normalised). */
|
|
@@ -1517,7 +1511,8 @@ export const SPAWN_SKILL_CONTRACT = {
|
|
|
1517
1511
|
'unattended floor:',
|
|
1518
1512
|
// The only intent that clears the floor, and the honest alternative.
|
|
1519
1513
|
'--approval allow',
|
|
1520
|
-
|
|
1514
|
+
// Every permission request waits for the Owner (D6).
|
|
1515
|
+
'waits for the Owner',
|
|
1521
1516
|
// Creation-time isolation — the one new operator input this release adds.
|
|
1522
1517
|
'--isolation-file',
|
|
1523
1518
|
],
|
|
@@ -1528,11 +1523,8 @@ export const SPAWN_SKILL_CONTRACT = {
|
|
|
1528
1523
|
* This list only pins the specific claim that was wrong.
|
|
1529
1524
|
*/
|
|
1530
1525
|
forbidden: [
|
|
1531
|
-
// The
|
|
1532
|
-
|
|
1533
|
-
// shortfall a doctor FAILURE — so the skill told you to build a role the
|
|
1534
|
-
// CLI then refused, in the same breath as telling you to trust doctor.
|
|
1535
|
-
'--approval ask --filesystem workspace --unattended deny',
|
|
1526
|
+
// The retired flag (D6), in any combination.
|
|
1527
|
+
'--unattended',
|
|
1536
1528
|
'[TODO:',
|
|
1537
1529
|
],
|
|
1538
1530
|
};
|
package/dist/doctor.js
CHANGED
|
@@ -354,7 +354,7 @@ export async function doctor(opts = {}, exec = realExec, platform = process.plat
|
|
|
354
354
|
continue;
|
|
355
355
|
}
|
|
356
356
|
const p = analysis.permissions;
|
|
357
|
-
const summary = `approval=${p.approval} filesystem=${p.filesystem}
|
|
357
|
+
const summary = `approval=${p.approval} filesystem=${p.filesystem}`
|
|
358
358
|
+ ` -> ${formatNative(analysis.native)}`;
|
|
359
359
|
checks.push({
|
|
360
360
|
name: `permissions: ${analysis.role}`, ok: true,
|
|
@@ -368,17 +368,15 @@ export async function doctor(opts = {}, exec = realExec, platform = process.plat
|
|
|
368
368
|
checks.push({
|
|
369
369
|
name: `permission conflict: ${analysis.role}`, ok: true, detail: conflict.warning,
|
|
370
370
|
});
|
|
371
|
-
// The floor is checked BEFORE start:
|
|
372
|
-
//
|
|
373
|
-
// harness with nobody attached to see it.
|
|
371
|
+
// The floor is checked BEFORE start: below it, the agent's own briefing needs permission requests, and each
|
|
372
|
+
// waits for the Owner's answer (session or feed) before the turn continues.
|
|
374
373
|
const floor = analysis.floor;
|
|
375
374
|
checks.push({
|
|
376
375
|
name: `unattended floor: ${analysis.role}`,
|
|
377
376
|
ok: floor.meets || analysis.floorSeverity !== 'fail',
|
|
378
377
|
detail: floor.meets
|
|
379
378
|
? `grants ${analysis.capabilities.join(', ')}`
|
|
380
|
-
: `MISSING ${floor.missing.join(', ')} —
|
|
381
|
-
+ `${p.unattended === 'deny' ? 'be denied silently' : 'block the turn'}; `
|
|
379
|
+
: `MISSING ${floor.missing.join(', ')} — these requests will wait for the Owner's answer; `
|
|
382
380
|
+ `grants only ${analysis.capabilities.join(', ') || '(nothing)'}`,
|
|
383
381
|
});
|
|
384
382
|
}
|
|
@@ -13,3 +13,15 @@ export declare function readDeliveredFile(stateDir: string, id: string): Promise
|
|
|
13
13
|
record: DeliveredFile;
|
|
14
14
|
bytes: Buffer;
|
|
15
15
|
}>;
|
|
16
|
+
/** The key of the conversation-file store this incarnation writes to (recorded with a status's attachments). */
|
|
17
|
+
export declare function artifactStoreKey(stateDir: string): string;
|
|
18
|
+
/**
|
|
19
|
+
* A delivered file in the store recorded when its status was published. A status keeps referring to its
|
|
20
|
+
* files after the agent's session is replaced (`--fresh` changes only the incarnation key; stores are never
|
|
21
|
+
* deleted). The bytes are verified against their record, and the record must equal the metadata the status
|
|
22
|
+
* copied from it at publish.
|
|
23
|
+
*/
|
|
24
|
+
export declare function findDeliveredFile(store: string, id: string, expected: Pick<DeliveredFile, 'name' | 'mimeType' | 'size' | 'sha256'>): Promise<{
|
|
25
|
+
record: DeliveredFile;
|
|
26
|
+
bytes: Buffer;
|
|
27
|
+
}>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createHash, randomUUID } from 'node:crypto';
|
|
2
2
|
import { constants, mkdirSync, readFileSync, readdirSync, lstatSync, openSync, fstatSync, closeSync, renameSync, writeFileSync } from 'node:fs';
|
|
3
3
|
import { open, unlink } from 'node:fs/promises';
|
|
4
|
-
import { join } from 'node:path';
|
|
4
|
+
import { basename, join } from 'node:path';
|
|
5
5
|
import { stateRoot } from '../paths.js';
|
|
6
6
|
import { openDirectory, MAX_FILE_BYTES } from './reader.js';
|
|
7
7
|
export function artifactDirectory(stateDir) {
|
|
@@ -93,9 +93,31 @@ export class ArtifactStore {
|
|
|
93
93
|
}
|
|
94
94
|
}
|
|
95
95
|
export async function readDeliveredFile(stateDir, id) {
|
|
96
|
+
return readFromDirectory(artifactDirectory(stateDir), id);
|
|
97
|
+
}
|
|
98
|
+
/** The key of the conversation-file store this incarnation writes to (recorded with a status's attachments). */
|
|
99
|
+
export function artifactStoreKey(stateDir) {
|
|
100
|
+
return basename(artifactDirectory(stateDir));
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* A delivered file in the store recorded when its status was published. A status keeps referring to its
|
|
104
|
+
* files after the agent's session is replaced (`--fresh` changes only the incarnation key; stores are never
|
|
105
|
+
* deleted). The bytes are verified against their record, and the record must equal the metadata the status
|
|
106
|
+
* copied from it at publish.
|
|
107
|
+
*/
|
|
108
|
+
export async function findDeliveredFile(store, id, expected) {
|
|
109
|
+
if (!/^[a-f0-9]{64}$/.test(store))
|
|
110
|
+
throw Error('ARTIFACT_NOT_FOUND');
|
|
111
|
+
const found = await readFromDirectory(join(stateRoot(), 'private-file-delivery', store), id);
|
|
112
|
+
const { record } = found;
|
|
113
|
+
if (record.name !== expected.name || record.mimeType !== expected.mimeType || record.size !== expected.size || record.sha256 !== expected.sha256)
|
|
114
|
+
throw Error('ARTIFACT_INTEGRITY_FAILED');
|
|
115
|
+
return found;
|
|
116
|
+
}
|
|
117
|
+
async function readFromDirectory(directory, id) {
|
|
96
118
|
if (!/^[a-f0-9-]{36}$/.test(id))
|
|
97
119
|
throw Error('ARTIFACT_NOT_FOUND');
|
|
98
|
-
const root = await openDirectory(
|
|
120
|
+
const root = await openDirectory(directory);
|
|
99
121
|
const read = (suffix, max) => {
|
|
100
122
|
const fd = openSync(`/proc/self/fd/${root.fd}/${id}.${suffix}`, constants.O_RDONLY | constants.O_NOFOLLOW | constants.O_NONBLOCK);
|
|
101
123
|
try {
|
|
@@ -454,7 +454,8 @@ function validConfiguration(value) {
|
|
|
454
454
|
&& (c.mission === undefined || (text(c.mission) && Array.from(String(c.mission)).length <= 80))
|
|
455
455
|
&& APPROVAL_MODES.has(String(c.approval))
|
|
456
456
|
&& FILESYSTEM_MODES.has(String(c.filesystem))
|
|
457
|
-
|
|
457
|
+
// Retired (D6): accepted only from records written before it was removed.
|
|
458
|
+
&& (c.unattended === undefined || UNATTENDED_MODES.has(String(c.unattended)))
|
|
458
459
|
&& record(c.permissionMode)
|
|
459
460
|
&& exact(c.permissionMode, ['fleetMode', 'nativeMode'])
|
|
460
461
|
&& FLEET_PERMISSION_MODES.has(String(c.permissionMode.fleetMode))
|
|
@@ -655,7 +656,7 @@ function agentConfigurationFieldGroups(configuration) {
|
|
|
655
656
|
['Effort', configuration.effort ? markdownProse(configuration.effort) : undefined],
|
|
656
657
|
['Approval', markdownProse(configuration.approval)],
|
|
657
658
|
['Filesystem', markdownProse(configuration.filesystem)],
|
|
658
|
-
['Wait', markdownProse(configuration.unattended)],
|
|
659
|
+
['Wait', configuration.unattended ? markdownProse(configuration.unattended) : undefined],
|
|
659
660
|
['Fleet mode', markdownProse(configuration.permissionMode.fleetMode)],
|
|
660
661
|
['Native mode', markdownProse(configuration.permissionMode.nativeMode)],
|
|
661
662
|
], optional, tail: [
|
package/dist/fleet-proxy.js
CHANGED
|
@@ -50,7 +50,6 @@ export function inheritCallerSpawnDefaults(caller, requested, configPath) {
|
|
|
50
50
|
if (options.approval === undefined)
|
|
51
51
|
take('approval', inheritedPermissionMode(caller));
|
|
52
52
|
take('filesystem', caller.permissions.filesystem);
|
|
53
|
-
take('unattended', caller.permissions.unattended);
|
|
54
53
|
take('monitorConfig', structuredClone(caller.monitor));
|
|
55
54
|
options.configPath = configPath;
|
|
56
55
|
options.surface = 'agent';
|
|
@@ -29,7 +29,7 @@ export function translateHermesPermissions(permissions) {
|
|
|
29
29
|
capabilities,
|
|
30
30
|
warnings: [
|
|
31
31
|
'Hermes modes mediate dangerous terminal commands and write_file/patch; browser, memory, skills, delegation and MCP side effects are not universally approval-mediated.',
|
|
32
|
-
'
|
|
32
|
+
'Fleet waits for the Owner without a timeout; Hermes’s own native 60-second dangerous-command timeout still ends an unanswered request, which Fleet records as ended when its turn finishes; protected-action floors remain active.',
|
|
33
33
|
...(permissions.filesystem === 'workspace' ? ['Workspace confinement is an approximation unless enforcing Fleet isolation is verified on this platform.'] : []),
|
|
34
34
|
],
|
|
35
35
|
};
|
|
@@ -73,7 +73,6 @@ export class HermesAgentSessionAdapter {
|
|
|
73
73
|
inheritEnvironment: false, stateDir: options.stateDir, mode: 'fresh',
|
|
74
74
|
permissions: options.permissions, modeId, requireMode: true,
|
|
75
75
|
permissionMode: { fleetMode: options.permissionMode.fleetMode, nativeMode: modeId },
|
|
76
|
-
permissionTimeoutMs: 50_000,
|
|
77
76
|
mcpServers: options.managedOurs ? [...hermesMcpServers(role, env).filter(s => s.name !== 'ours'), options.managedOurs.server] : hermesMcpServers(role, env),
|
|
78
77
|
scrubObsoleteOursAutostart: true,
|
|
79
78
|
validateStartupResponse: async (initialized, created) => {
|
package/dist/init-wizard.js
CHANGED
|
@@ -194,7 +194,7 @@ export function generateSetup(answers) {
|
|
|
194
194
|
'api_version: ours.network/fleet/v2',
|
|
195
195
|
'',
|
|
196
196
|
'defaults:',
|
|
197
|
-
' permissions: { approval: ask, filesystem: workspace
|
|
197
|
+
' permissions: { approval: ask, filesystem: workspace }',
|
|
198
198
|
'',
|
|
199
199
|
].join('\n'));
|
|
200
200
|
for (const work of WORK_KINDS) {
|
|
@@ -233,7 +233,7 @@ export function generateSetup(answers) {
|
|
|
233
233
|
`brain: { ref: ${PURPOSE_BRAINS[ROLE_WORK[role]].id} }`,
|
|
234
234
|
'coordinator: FleetCoordinator',
|
|
235
235
|
// Temporary default while the product is being tested: prepared agents work without asking.
|
|
236
|
-
'permissions: { approval: allow, filesystem: unrestricted
|
|
236
|
+
'permissions: { approval: allow, filesystem: unrestricted }',
|
|
237
237
|
'monitor: { mode: fleet, interrupt: after_tool }',
|
|
238
238
|
'',
|
|
239
239
|
].join('\n'));
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AgentSelection, ApprovalMode, FilesystemMode, FleetPermissionMode, MonitorInterrupt, MonitorMode, ResolvedRole, SessionBackendId
|
|
1
|
+
import type { AgentSelection, ApprovalMode, FilesystemMode, FleetPermissionMode, MonitorInterrupt, MonitorMode, ResolvedRole, SessionBackendId } from './config.js';
|
|
2
2
|
import type { IsolationBackendId, NetworkMode, OnUnavailable } from './isolation/types.js';
|
|
3
3
|
/**
|
|
4
4
|
* Operator-facing launch configuration captured at the launch boundary from
|
|
@@ -29,7 +29,8 @@ export interface AgentLaunchConfiguration {
|
|
|
29
29
|
mission?: string;
|
|
30
30
|
approval: ApprovalMode;
|
|
31
31
|
filesystem: FilesystemMode;
|
|
32
|
-
|
|
32
|
+
/** Retired (D6): present only in records written before every permission request waited for the Owner. */
|
|
33
|
+
unattended?: 'deny' | 'wait';
|
|
33
34
|
/** Portable policy plus the exact native runtime mode after harness_options. */
|
|
34
35
|
permissionMode: {
|
|
35
36
|
fleetMode: FleetPermissionMode;
|
|
@@ -48,7 +48,6 @@ export function summarizeResolvedLaunch(role, origins) {
|
|
|
48
48
|
...(mission ? { mission } : {}),
|
|
49
49
|
approval: role.permissions.approval,
|
|
50
50
|
filesystem: role.permissions.filesystem,
|
|
51
|
-
unattended: role.permissions.unattended,
|
|
52
51
|
permissionMode: origins.permissionMode,
|
|
53
52
|
monitor: { mode: role.monitor.mode, interrupt: role.monitor.interrupt },
|
|
54
53
|
...(role.isolation?.backend ? { isolation: {
|
|
@@ -108,8 +107,8 @@ function mandatoryComponents(configuration) {
|
|
|
108
107
|
`harness ${markdownCode(configuration.harness)}`,
|
|
109
108
|
`model ${configuration.model === null ? 'harness-default' : markdownCode(configuration.model)}`,
|
|
110
109
|
configuration.effort ? `effort ${markdownProse(configuration.effort)}` : undefined,
|
|
111
|
-
`approval=${configuration.approval}, filesystem=${configuration.filesystem}
|
|
112
|
-
+
|
|
110
|
+
`approval=${configuration.approval}, filesystem=${configuration.filesystem}`
|
|
111
|
+
+ (configuration.unattended ? `, unattended=${configuration.unattended}` : ''),
|
|
113
112
|
`mode ${configuration.permissionMode.fleetMode}/${markdownProse(configuration.permissionMode.nativeMode)}`,
|
|
114
113
|
].filter((part) => Boolean(part));
|
|
115
114
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { createHash } from 'node:crypto';
|
|
2
1
|
import { NativeClaudeConversation } from './application/native-claude-conversation.js';
|
|
3
|
-
import { realpathSync } from 'node:fs';
|
|
2
|
+
import { mkdirSync, readFileSync, readdirSync, realpathSync, watch as watchDirectory } from 'node:fs';
|
|
3
|
+
import { atomicPrivateWrite } from './agent-ours/state.js';
|
|
4
4
|
import { join, resolve } from 'node:path';
|
|
5
5
|
import { homedir } from 'node:os';
|
|
6
6
|
import { setTimeout as sleep } from 'node:timers/promises';
|
|
7
7
|
import { InvalidArgumentError } from 'commander';
|
|
8
8
|
import { inspectCodexThread, listLoadedCodexThreads, validateCodexSocket, verifyCodexBinding, wakeCodexThread } from './native-codex-wake.js';
|
|
9
|
-
import { NativeParticipation, nativeHostProfile,
|
|
9
|
+
import { NativeParticipation, nativeHostProfile, wakePrompt } from './native-participation.js';
|
|
10
10
|
function harness(value) {
|
|
11
11
|
if (value === 'claude' || value === 'codex')
|
|
12
12
|
return value;
|
|
@@ -132,7 +132,7 @@ async function watch(store, host, session, signal) {
|
|
|
132
132
|
}
|
|
133
133
|
export function registerNativeParticipationCommands(program) {
|
|
134
134
|
const participation = program.command('participation')
|
|
135
|
-
.description('
|
|
135
|
+
.description('Let ordinary Claude Code and Codex terminal sessions join Fleet voluntarily');
|
|
136
136
|
const store = async () => new NativeParticipation(await nativeHostProfile());
|
|
137
137
|
participation.command('enable')
|
|
138
138
|
.description('Authorize automatic registration and peer-triggered wake under one Human')
|
|
@@ -185,6 +185,7 @@ export function registerNativeParticipationCommands(program) {
|
|
|
185
185
|
else if (event === 'SessionStart' || event === 'Stop')
|
|
186
186
|
await watch(registry, 'claude', session);
|
|
187
187
|
});
|
|
188
|
+
// One-shot state exchange, run by the ours-fleet-native plugin on session events (not on a timer).
|
|
188
189
|
participation.command('claude-bridge', { hidden: true }).argument('<session-id>', 'native session UUID', nativeId).action(async (session) => {
|
|
189
190
|
let input = '';
|
|
190
191
|
for await (const chunk of process.stdin) {
|
|
@@ -192,21 +193,65 @@ export function registerNativeParticipationCommands(program) {
|
|
|
192
193
|
if (input.length > 1024 * 1024)
|
|
193
194
|
throw Error('Claude bridge payload too large');
|
|
194
195
|
}
|
|
195
|
-
const registry = await store(),
|
|
196
|
-
|
|
197
|
-
if (!row || !grant) {
|
|
196
|
+
const registry = await store(), joined = registry.claudeBridge(session);
|
|
197
|
+
if (!joined) {
|
|
198
198
|
console.log('{}');
|
|
199
199
|
return;
|
|
200
200
|
}
|
|
201
201
|
const state = JSON.parse(input);
|
|
202
202
|
if (typeof state.transcriptPath !== 'string' || !['idle', 'busy', 'waiting'].includes(state.status) || typeof state.correlations !== 'object' || !Array.isArray(state.finished))
|
|
203
203
|
throw Error('Invalid Claude bridge state');
|
|
204
|
-
const
|
|
205
|
-
const guard = () => { if (registry.authorization()?.grant !== grant.grant || !registry.list().some(r => r.cid === row.cid))
|
|
204
|
+
const guard = () => { if (registry.claudeBridge(session)?.cid !== joined.cid)
|
|
206
205
|
throw Error('Native participation withdrawn'); };
|
|
207
|
-
const bridge = new NativeClaudeConversation(
|
|
206
|
+
const bridge = new NativeClaudeConversation(joined.directory, session, guard);
|
|
208
207
|
console.log(JSON.stringify(await bridge.pulse(state)));
|
|
209
208
|
});
|
|
209
|
+
// The plugin's one long-lived child per Claude session: it says "input" when the App queues a prompt and
|
|
210
|
+
// keeps a heartbeat, so the plugin runs claude-bridge only when something happened.
|
|
211
|
+
participation.command('claude-watch', { hidden: true }).argument('<session-id>', 'native session UUID', nativeId).action(async (session) => {
|
|
212
|
+
const registry = await store(), parent = process.ppid;
|
|
213
|
+
const say = (line) => { process.stdout.write(line + '\n'); };
|
|
214
|
+
let joined = registry.claudeBridge(session);
|
|
215
|
+
// The SessionStart hook creates the session's identity; wait for that join while the grant stands.
|
|
216
|
+
while (!joined) {
|
|
217
|
+
if (!registry.authorization() || process.ppid !== parent)
|
|
218
|
+
return;
|
|
219
|
+
await sleep(2000);
|
|
220
|
+
joined = registry.claudeBridge(session);
|
|
221
|
+
}
|
|
222
|
+
const directory = joined.directory;
|
|
223
|
+
mkdirSync(directory, { recursive: true, mode: 0o700 });
|
|
224
|
+
const unclaimed = () => readdirSync(directory).filter(name => /^input-[a-f0-9]+\.json$/.test(name)).some(name => {
|
|
225
|
+
try {
|
|
226
|
+
return !JSON.parse(readFileSync(join(directory, name), 'utf8')).claimed;
|
|
227
|
+
}
|
|
228
|
+
catch {
|
|
229
|
+
return false;
|
|
230
|
+
}
|
|
231
|
+
});
|
|
232
|
+
say('joined');
|
|
233
|
+
const watcher = watchDirectory(directory, (_event, name) => { if (name && /^input-[a-f0-9]+\.json$/.test(String(name)) && unclaimed())
|
|
234
|
+
say('input'); });
|
|
235
|
+
try {
|
|
236
|
+
for (let tick = 0;; tick++) {
|
|
237
|
+
if (registry.claudeBridge(session)?.cid !== joined.cid) {
|
|
238
|
+
say('left');
|
|
239
|
+
return;
|
|
240
|
+
}
|
|
241
|
+
// Orphaned when Claude exits without unloading the plugin.
|
|
242
|
+
if (process.ppid !== parent)
|
|
243
|
+
return;
|
|
244
|
+
atomicPrivateWrite(join(directory, 'alive.json'), { pid: process.pid, at: Date.now() });
|
|
245
|
+
// A missed change notification is caught by this rescan.
|
|
246
|
+
if (tick % 6 === 5 && unclaimed())
|
|
247
|
+
say('input');
|
|
248
|
+
await sleep(5000);
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
finally {
|
|
252
|
+
watcher.close();
|
|
253
|
+
}
|
|
254
|
+
});
|
|
210
255
|
participation.command('serve-codex')
|
|
211
256
|
.description('Discover native conversations on the authorized local Codex App Server and wake them on mail')
|
|
212
257
|
.action(async () => serveCodex(await store()));
|
|
@@ -56,6 +56,180 @@ export declare class NativeParticipation {
|
|
|
56
56
|
limit?: number;
|
|
57
57
|
before_seq?: number;
|
|
58
58
|
}): Promise<unknown>;
|
|
59
|
+
/**
|
|
60
|
+
* The App's agent tools (contacts, invites, messaging) for a native participant: the same fixed-identity
|
|
61
|
+
* Ours MCP server a managed agent's supervisor serves, run over the session's own bound attachment. The
|
|
62
|
+
* binding is checked before the server starts and again around every call; file tools are refused because
|
|
63
|
+
* a terminal session has no sandbox file context to act in.
|
|
64
|
+
*/
|
|
65
|
+
withOursTools<T>(name: string, work: (client: import('@modelcontextprotocol/sdk/client/index.js').Client, identity: {
|
|
66
|
+
name: string;
|
|
67
|
+
cid: string;
|
|
68
|
+
generation: string;
|
|
69
|
+
}, verify: () => Promise<void>) => Promise<T>): Promise<T>;
|
|
70
|
+
listOursTools(name: string): Promise<{
|
|
71
|
+
tools: {
|
|
72
|
+
inputSchema: {
|
|
73
|
+
[x: string]: unknown;
|
|
74
|
+
type: "object";
|
|
75
|
+
properties?: Record<string, object> | undefined;
|
|
76
|
+
required?: string[] | undefined;
|
|
77
|
+
};
|
|
78
|
+
name: string;
|
|
79
|
+
description?: string | undefined;
|
|
80
|
+
outputSchema?: {
|
|
81
|
+
[x: string]: unknown;
|
|
82
|
+
type: "object";
|
|
83
|
+
properties?: Record<string, object> | undefined;
|
|
84
|
+
required?: string[] | undefined;
|
|
85
|
+
} | undefined;
|
|
86
|
+
annotations?: {
|
|
87
|
+
title?: string | undefined;
|
|
88
|
+
readOnlyHint?: boolean | undefined;
|
|
89
|
+
destructiveHint?: boolean | undefined;
|
|
90
|
+
idempotentHint?: boolean | undefined;
|
|
91
|
+
openWorldHint?: boolean | undefined;
|
|
92
|
+
} | undefined;
|
|
93
|
+
execution?: {
|
|
94
|
+
taskSupport?: "optional" | "required" | "forbidden" | undefined;
|
|
95
|
+
} | undefined;
|
|
96
|
+
_meta?: Record<string, unknown> | undefined;
|
|
97
|
+
icons?: {
|
|
98
|
+
src: string;
|
|
99
|
+
mimeType?: string | undefined;
|
|
100
|
+
sizes?: string[] | undefined;
|
|
101
|
+
theme?: "light" | "dark" | undefined;
|
|
102
|
+
}[] | undefined;
|
|
103
|
+
title?: string | undefined;
|
|
104
|
+
}[];
|
|
105
|
+
_meta?: {
|
|
106
|
+
[x: string]: unknown;
|
|
107
|
+
progressToken?: string | number | undefined;
|
|
108
|
+
"io.modelcontextprotocol/related-task"?: {
|
|
109
|
+
taskId: string;
|
|
110
|
+
} | undefined;
|
|
111
|
+
} | undefined;
|
|
112
|
+
nextCursor?: string | undefined;
|
|
113
|
+
agent: string;
|
|
114
|
+
identity: {
|
|
115
|
+
name: string;
|
|
116
|
+
cid: string;
|
|
117
|
+
generation: string;
|
|
118
|
+
};
|
|
119
|
+
}>;
|
|
120
|
+
callOursTool(name: string, request: {
|
|
121
|
+
tool: string;
|
|
122
|
+
arguments?: Record<string, unknown>;
|
|
123
|
+
}): Promise<{
|
|
124
|
+
agent: string;
|
|
125
|
+
identity: {
|
|
126
|
+
name: string;
|
|
127
|
+
cid: string;
|
|
128
|
+
generation: string;
|
|
129
|
+
};
|
|
130
|
+
result: {
|
|
131
|
+
[x: string]: unknown;
|
|
132
|
+
content: ({
|
|
133
|
+
type: "text";
|
|
134
|
+
text: string;
|
|
135
|
+
annotations?: {
|
|
136
|
+
audience?: ("user" | "assistant")[] | undefined;
|
|
137
|
+
priority?: number | undefined;
|
|
138
|
+
lastModified?: string | undefined;
|
|
139
|
+
} | undefined;
|
|
140
|
+
_meta?: Record<string, unknown> | undefined;
|
|
141
|
+
} | {
|
|
142
|
+
type: "image";
|
|
143
|
+
data: string;
|
|
144
|
+
mimeType: string;
|
|
145
|
+
annotations?: {
|
|
146
|
+
audience?: ("user" | "assistant")[] | undefined;
|
|
147
|
+
priority?: number | undefined;
|
|
148
|
+
lastModified?: string | undefined;
|
|
149
|
+
} | undefined;
|
|
150
|
+
_meta?: Record<string, unknown> | undefined;
|
|
151
|
+
} | {
|
|
152
|
+
type: "audio";
|
|
153
|
+
data: string;
|
|
154
|
+
mimeType: string;
|
|
155
|
+
annotations?: {
|
|
156
|
+
audience?: ("user" | "assistant")[] | undefined;
|
|
157
|
+
priority?: number | undefined;
|
|
158
|
+
lastModified?: string | undefined;
|
|
159
|
+
} | undefined;
|
|
160
|
+
_meta?: Record<string, unknown> | undefined;
|
|
161
|
+
} | {
|
|
162
|
+
type: "resource";
|
|
163
|
+
resource: {
|
|
164
|
+
uri: string;
|
|
165
|
+
text: string;
|
|
166
|
+
mimeType?: string | undefined;
|
|
167
|
+
_meta?: Record<string, unknown> | undefined;
|
|
168
|
+
} | {
|
|
169
|
+
uri: string;
|
|
170
|
+
blob: string;
|
|
171
|
+
mimeType?: string | undefined;
|
|
172
|
+
_meta?: Record<string, unknown> | undefined;
|
|
173
|
+
};
|
|
174
|
+
annotations?: {
|
|
175
|
+
audience?: ("user" | "assistant")[] | undefined;
|
|
176
|
+
priority?: number | undefined;
|
|
177
|
+
lastModified?: string | undefined;
|
|
178
|
+
} | undefined;
|
|
179
|
+
_meta?: Record<string, unknown> | undefined;
|
|
180
|
+
} | {
|
|
181
|
+
uri: string;
|
|
182
|
+
name: string;
|
|
183
|
+
type: "resource_link";
|
|
184
|
+
description?: string | undefined;
|
|
185
|
+
mimeType?: string | undefined;
|
|
186
|
+
size?: number | undefined;
|
|
187
|
+
annotations?: {
|
|
188
|
+
audience?: ("user" | "assistant")[] | undefined;
|
|
189
|
+
priority?: number | undefined;
|
|
190
|
+
lastModified?: string | undefined;
|
|
191
|
+
} | undefined;
|
|
192
|
+
_meta?: {
|
|
193
|
+
[x: string]: unknown;
|
|
194
|
+
} | undefined;
|
|
195
|
+
icons?: {
|
|
196
|
+
src: string;
|
|
197
|
+
mimeType?: string | undefined;
|
|
198
|
+
sizes?: string[] | undefined;
|
|
199
|
+
theme?: "light" | "dark" | undefined;
|
|
200
|
+
}[] | undefined;
|
|
201
|
+
title?: string | undefined;
|
|
202
|
+
})[];
|
|
203
|
+
_meta?: {
|
|
204
|
+
[x: string]: unknown;
|
|
205
|
+
progressToken?: string | number | undefined;
|
|
206
|
+
"io.modelcontextprotocol/related-task"?: {
|
|
207
|
+
taskId: string;
|
|
208
|
+
} | undefined;
|
|
209
|
+
} | undefined;
|
|
210
|
+
structuredContent?: Record<string, unknown> | undefined;
|
|
211
|
+
isError?: boolean | undefined;
|
|
212
|
+
} | {
|
|
213
|
+
[x: string]: unknown;
|
|
214
|
+
toolResult: unknown;
|
|
215
|
+
_meta?: {
|
|
216
|
+
[x: string]: unknown;
|
|
217
|
+
progressToken?: string | number | undefined;
|
|
218
|
+
"io.modelcontextprotocol/related-task"?: {
|
|
219
|
+
taskId: string;
|
|
220
|
+
} | undefined;
|
|
221
|
+
} | undefined;
|
|
222
|
+
};
|
|
223
|
+
}>;
|
|
224
|
+
/**
|
|
225
|
+
* Where a joined Claude session's plugin bridge lives under the current grant. Unlike the directory listing,
|
|
226
|
+
* it does not depend on the watcher's recent poll, so a long turn does not cut the plugin off.
|
|
227
|
+
*/
|
|
228
|
+
claudeBridge(session: string): {
|
|
229
|
+
directory: string;
|
|
230
|
+
cid: string;
|
|
231
|
+
grant: string;
|
|
232
|
+
} | undefined;
|
|
59
233
|
setMetadata(harness: NativeHarness, session: string, metadata: {
|
|
60
234
|
title?: string;
|
|
61
235
|
cwd?: string;
|