@superjackfruitlabs/salaam 0.0.1 → 0.0.2

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.
Files changed (110) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/README.md +25 -17
  3. package/dist/src/a2a-backend.js +225 -0
  4. package/dist/src/a2a-inbound.js +487 -0
  5. package/dist/src/a2a-peer.js +370 -0
  6. package/dist/src/a2a-protocol.js +250 -0
  7. package/dist/src/agent-profiles.js +289 -0
  8. package/dist/src/children.js +132 -26
  9. package/dist/src/claude-provider.js +2 -179
  10. package/dist/src/cli-help.js +107 -6
  11. package/dist/src/cli.js +477 -13
  12. package/dist/src/config.js +26 -3
  13. package/dist/src/credentials.js +7 -2
  14. package/dist/src/external-runtime.js +1 -0
  15. package/dist/src/external-work.js +583 -0
  16. package/dist/src/harness-backend.js +466 -0
  17. package/dist/src/harness-container.js +450 -0
  18. package/dist/src/harness-model-gateway.js +104 -0
  19. package/dist/src/harness-prepare.js +88 -0
  20. package/dist/src/harness-probe.js +111 -0
  21. package/dist/src/harness-protocol.js +325 -0
  22. package/dist/src/harness-readiness.js +50 -0
  23. package/dist/src/harness-rpc.js +206 -0
  24. package/dist/src/harness-tool-identity.js +87 -0
  25. package/dist/src/harness-wire-bridge.js +387 -0
  26. package/dist/src/host.js +6 -1
  27. package/dist/src/house-extension.js +147 -64
  28. package/dist/src/live-provider.js +301 -0
  29. package/dist/src/managed.js +33 -3
  30. package/dist/src/protocol.js +9 -5
  31. package/dist/src/provider-auth.js +300 -0
  32. package/dist/src/provider-config.js +65 -17
  33. package/dist/src/provider-model.js +78 -0
  34. package/dist/src/provider-payload.js +264 -0
  35. package/dist/src/provider-transport.js +36 -0
  36. package/dist/src/provider-usage.js +59 -0
  37. package/dist/src/repository-snapshots.js +219 -0
  38. package/dist/src/service.js +274 -9
  39. package/dist/src/store.js +44 -2
  40. package/dist/src/supervisor.js +246 -35
  41. package/dist/src/task-budget.js +17 -8
  42. package/dist/src/task-context.js +15 -0
  43. package/dist/src/task-driver.js +38 -14
  44. package/dist/src/task-policy.js +20 -1
  45. package/dist/src/task-verification.js +3 -0
  46. package/dist/src/task-work.js +31 -0
  47. package/dist/src/team-work.js +378 -0
  48. package/dist/src/tui-view.js +65 -10
  49. package/dist/src/tui.js +4 -2
  50. package/dist/src/usage.js +18 -0
  51. package/dist/src/worker-boundary.js +298 -0
  52. package/dist/src/worker-workspaces.js +274 -0
  53. package/dist/src/workspaces.js +6 -2
  54. package/harness-runtime/codex-pins.json +10 -0
  55. package/harness-runtime/package-lock.json +560 -0
  56. package/harness-runtime/package.json +9 -0
  57. package/npm-shrinkwrap.json +57 -2
  58. package/package.json +2 -1
  59. package/src/a2a-backend.ts +254 -0
  60. package/src/a2a-inbound.ts +585 -0
  61. package/src/a2a-peer.ts +441 -0
  62. package/src/a2a-protocol.ts +286 -0
  63. package/src/agent-profiles.ts +379 -0
  64. package/src/children.ts +168 -27
  65. package/src/claude-provider.ts +2 -189
  66. package/src/cli-help.ts +107 -6
  67. package/src/cli.ts +602 -12
  68. package/src/config.ts +34 -3
  69. package/src/credentials.ts +9 -2
  70. package/src/external-runtime.ts +54 -0
  71. package/src/external-work.ts +663 -0
  72. package/src/harness-backend.ts +557 -0
  73. package/src/harness-container.ts +543 -0
  74. package/src/harness-model-gateway.ts +138 -0
  75. package/src/harness-prepare.ts +113 -0
  76. package/src/harness-probe.ts +150 -0
  77. package/src/harness-protocol.ts +388 -0
  78. package/src/harness-readiness.ts +71 -0
  79. package/src/harness-rpc.ts +244 -0
  80. package/src/harness-tool-identity.ts +91 -0
  81. package/src/harness-wire-bridge.ts +418 -0
  82. package/src/host.ts +11 -6
  83. package/src/house-extension.ts +165 -66
  84. package/src/live-provider.ts +347 -0
  85. package/src/managed.ts +43 -4
  86. package/src/protocol.ts +36 -8
  87. package/src/provider-auth.ts +336 -0
  88. package/src/provider-config.ts +89 -18
  89. package/src/provider-model.ts +86 -0
  90. package/src/provider-payload.ts +263 -0
  91. package/src/provider-transport.ts +51 -0
  92. package/src/provider-usage.ts +64 -0
  93. package/src/repository-snapshots.ts +259 -0
  94. package/src/service.ts +446 -11
  95. package/src/store.ts +60 -4
  96. package/src/supervisor.ts +294 -41
  97. package/src/task-budget.ts +24 -11
  98. package/src/task-context.ts +17 -0
  99. package/src/task-driver.ts +51 -15
  100. package/src/task-policy.ts +23 -3
  101. package/src/task-verification.ts +2 -0
  102. package/src/task-work.ts +46 -1
  103. package/src/team-work.ts +554 -0
  104. package/src/tui-client.ts +5 -0
  105. package/src/tui-view.ts +164 -12
  106. package/src/tui.ts +5 -2
  107. package/src/usage.ts +17 -0
  108. package/src/worker-boundary.ts +395 -0
  109. package/src/worker-workspaces.ts +390 -0
  110. package/src/workspaces.ts +4 -2
package/src/config.ts CHANGED
@@ -2,6 +2,7 @@ import { readFileSync, existsSync } from 'node:fs';
2
2
  import { dirname, join, resolve } from 'node:path';
3
3
  import { fileURLToPath } from 'node:url';
4
4
  import { digest, textDigest } from './protocol.js';
5
+ import { PI_PROVIDERS } from './provider-config.js';
5
6
  import { packageDigest } from './package-digest.js';
6
7
 
7
8
  let root = dirname(fileURLToPath(import.meta.url));
@@ -19,7 +20,7 @@ export const PI_ROOT = resolve(
19
20
  export const PI_CLI = join(PI_ROOT, 'dist/bundle/cli.js');
20
21
  export const HOUSE_EXTENSION = join(ROOT, 'dist/src/house-extension.js');
21
22
  export const POLICY = {
22
- version: 6,
23
+ version: 14,
23
24
  tools: [
24
25
  'salaam_probe',
25
26
  'salaam_review',
@@ -30,6 +31,9 @@ export const POLICY = {
30
31
  'salaam_history',
31
32
  'salaam_files',
32
33
  'salaam_command',
34
+ 'salaam_repository',
35
+ 'salaam_findings',
36
+ 'salaam_team',
33
37
  ],
34
38
  children: {
35
39
  maxDepth: 1,
@@ -37,13 +41,23 @@ export const POLICY = {
37
41
  parentRequestBudget: 16,
38
42
  maxChildRequestBudget: 8,
39
43
  authority: ['salaam_probe'],
44
+ worker_boundary: 'frozen-native-model-request-v1',
45
+ specialist_profiles: 'operator-admitted-snapshot-v1',
46
+ team_claims: 'task-step-generation-v1',
47
+ daemon_workers: 8,
48
+ messages: 'passive-durable-explicit-ack-v1',
49
+ writing: 'owned-draft-explicit-hash-bound-integration-v1',
50
+ external: 'operator-pinned-whole-runtime-explicit-invocation-v1',
51
+ a2a: 'pinned-peer-one-turn-analysis-explicit-invocation-v1',
40
52
  },
41
53
  providers: [
42
54
  'salaam-proof/scripted',
43
- 'anthropic/claude-sonnet-5-5',
44
- 'anthropic/claude-sonnet-4-6',
55
+ ...PI_PROVIDERS.flatMap((provider) =>
56
+ provider.getModels().map((model) => provider.id + '/' + model.id),
57
+ ).sort(),
45
58
  ],
46
59
  provider_retries: 0,
60
+ task_token_budget: 'capped-default-explicit-null-opt-out-v1',
47
61
  compaction: { strategy: 'explicit-task-checkpoint-v1', automatic: false, keepRecentTokens: 512 },
48
62
  external_effects: 'explicit-connector-and-operation-approval',
49
63
  coding: {
@@ -80,9 +94,26 @@ export function bundleDigest(): string {
80
94
  policy: POLICY_DIGEST,
81
95
  lock: textDigest(readFileSync(lockPath, 'utf8')),
82
96
  house: textDigest(readFileSync(HOUSE_EXTENSION, 'utf8')),
97
+ provider_usage: textDigest(readFileSync(join(ROOT, 'dist/src/provider-usage.js'), 'utf8')),
98
+ provider_model: textDigest(readFileSync(join(ROOT, 'dist/src/provider-model.js'), 'utf8')),
99
+ live_provider: textDigest(readFileSync(join(ROOT, 'dist/src/live-provider.js'), 'utf8')),
100
+ provider_payload: textDigest(readFileSync(join(ROOT, 'dist/src/provider-payload.js'), 'utf8')),
101
+ provider_transport: textDigest(
102
+ readFileSync(join(ROOT, 'dist/src/provider-transport.js'), 'utf8'),
103
+ ),
104
+ provider_auth: textDigest(readFileSync(join(ROOT, 'dist/src/provider-auth.js'), 'utf8')),
83
105
  claude: textDigest(readFileSync(join(ROOT, 'dist/src/claude-provider.js'), 'utf8')),
84
106
  provider_config: textDigest(readFileSync(join(ROOT, 'dist/src/provider-config.js'), 'utf8')),
85
107
  protocol: textDigest(readFileSync(join(ROOT, 'dist/src/protocol.js'), 'utf8')),
108
+ worker_boundary: textDigest(readFileSync(join(ROOT, 'dist/src/worker-boundary.js'), 'utf8')),
109
+ agent_profiles: textDigest(readFileSync(join(ROOT, 'dist/src/agent-profiles.js'), 'utf8')),
110
+ team_work: textDigest(readFileSync(join(ROOT, 'dist/src/team-work.js'), 'utf8')),
111
+ worker_workspaces: textDigest(
112
+ readFileSync(join(ROOT, 'dist/src/worker-workspaces.js'), 'utf8'),
113
+ ),
114
+ repository_snapshots: textDigest(
115
+ readFileSync(join(ROOT, 'dist/src/repository-snapshots.js'), 'utf8'),
116
+ ),
86
117
  transport: textDigest(readFileSync(join(ROOT, 'dist/src/transport.js'), 'utf8')),
87
118
  });
88
119
  }
@@ -73,7 +73,10 @@ export function saveApiKey(value: string, path = credentialPath()): void {
73
73
  closeSync(directory);
74
74
  }
75
75
  }
76
- export async function readSecret(): Promise<string> {
76
+ export async function readSecret(
77
+ label = 'Claude API key (hidden): ',
78
+ signal?: AbortSignal,
79
+ ): Promise<string> {
77
80
  if (!process.stdin.isTTY) {
78
81
  let input = '';
79
82
  for await (const chunk of process.stdin) {
@@ -82,7 +85,7 @@ export async function readSecret(): Promise<string> {
82
85
  }
83
86
  return input;
84
87
  }
85
- process.stderr.write('Claude API key (hidden): ');
88
+ process.stderr.write(label);
86
89
  const stdin = process.stdin,
87
90
  wasRaw = stdin.isRaw;
88
91
  stdin.setRawMode(true);
@@ -90,6 +93,7 @@ export async function readSecret(): Promise<string> {
90
93
  return new Promise((resolve, reject) => {
91
94
  let key = '';
92
95
  const done = (error?: Error) => {
96
+ signal?.removeEventListener('abort', aborted);
93
97
  stdin.off('data', data);
94
98
  stdin.setRawMode(wasRaw);
95
99
  stdin.pause();
@@ -117,6 +121,9 @@ export async function readSecret(): Promise<string> {
117
121
  }
118
122
  }
119
123
  };
124
+ const aborted = () => done(new Error('Credential entry cancelled'));
125
+ signal?.addEventListener('abort', aborted, { once: true });
120
126
  stdin.on('data', data);
127
+ if (signal?.aborted) aborted();
121
128
  });
122
129
  }
@@ -0,0 +1,54 @@
1
+ import type { HarnessCheckpoint } from './harness-protocol.js';
2
+ import type { HarnessTarget } from './harness-probe.js';
3
+ import type { WorkerBinding } from './worker-boundary.js';
4
+ import type { WorkspaceTree } from './workspaces.js';
5
+ import type { A2ACheckpoint } from './a2a-protocol.js';
6
+
7
+ export type ExternalCheckpoint = HarnessCheckpoint | A2ACheckpoint;
8
+
9
+ /** Operator configuration only. Project profiles cannot select executables, endpoints or credentials. */
10
+ export interface ExternalRuntime {
11
+ id: string;
12
+ kind: 'harness' | 'a2a';
13
+ target: HarnessTarget | 'a2a';
14
+ version: string;
15
+ config_digest: string;
16
+ adapter_digest: string;
17
+ execution_identity: { version: string; kernel: string; arch: string };
18
+ boundary_digest: string;
19
+ engine_id: string;
20
+ evidence: 'proven' | 'fixture';
21
+ model_usage: 'unknown';
22
+ provider_route?: { provider: string; model: string; wire: string; wire_model: string };
23
+ output_cap: number | null;
24
+ max_model_requests: number | null;
25
+ files: boolean;
26
+ commands: boolean;
27
+ }
28
+ export interface ExternalHooks {
29
+ failed(error: Error): void;
30
+ modelRequest(id: string, bytes: number, output: number): void;
31
+ checkpoint(value: ExternalCheckpoint): undefined;
32
+ receipt(value: unknown): undefined;
33
+ permission(method: string, params: Record<string, unknown>): Promise<'approve' | 'deny'>;
34
+ toolResult(id: string, success: boolean, receipt: unknown): void;
35
+ assertActive(): void;
36
+ }
37
+ export interface ExternalBackend {
38
+ prepare?(): Promise<void>;
39
+ close?(): Promise<void>;
40
+ runtimes(): ExternalRuntime[];
41
+ validate(runtime: ExternalRuntime): void;
42
+ assertAuthority?(runtime: ExternalRuntime, tools: readonly string[]): void;
43
+ execute(
44
+ binding: WorkerBinding,
45
+ run: string,
46
+ prompt: string,
47
+ tree: WorkspaceTree,
48
+ hooks: ExternalHooks,
49
+ ): Promise<{ result: unknown }>;
50
+ /** Read only after stop has confirmed all owned processes are gone. */
51
+ collect(run: string, runtime: ExternalRuntime): WorkspaceTree;
52
+ /** Must reconcile owned resources by durable run ID even if creation's reply was lost. */
53
+ stop(run: string, runtime: ExternalRuntime, receipt: unknown): Promise<unknown>;
54
+ }