@inneranimalmedia/agentsam-sdk 2.6.8 → 2.6.9

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 (104) hide show
  1. package/apps/README.md +25 -0
  2. package/apps/cad-creator/shared/cad/package.json +1 -1
  3. package/apps/client-cms-editor/backend/package.json +4 -6
  4. package/apps/client-cms-editor/frontend/package.json +6 -8
  5. package/apps/client-cms-editor/frontend/tsconfig.json +27 -8
  6. package/apps/client-cms-editor/package.json +1 -1
  7. package/apps/client-cms-editor/shared/cms/package.json +4 -6
  8. package/docs/LOCAL_ENGINE_COMPUTE_AUDIT_PLAN.md +299 -0
  9. package/package.json +18 -7
  10. package/packages/agentsam-brand/package.json +1 -1
  11. package/packages/agentsam-contracts/package.json +71 -20
  12. package/packages/agentsam-contracts/scripts/build.mjs +18 -0
  13. package/packages/agentsam-contracts/test/contracts.test.mjs +4 -1
  14. package/packages/agentsam-contracts/test/repository.test.mjs +4 -1
  15. package/packages/agentsam-contracts/tsconfig.build.json +10 -0
  16. package/packages/agentsam-errors/package.json +3 -2
  17. package/packages/agentsam-goap/package.json +2 -2
  18. package/packages/agentsam-knowledge/package.json +3 -2
  19. package/packages/agentsam-nav/package.json +1 -1
  20. package/packages/agentsam-queue-control/package.json +1 -1
  21. package/packages/agentsam-rapid-rust/src/main.rs +1 -0
  22. package/packages/agentsam-repository/package.json +3 -2
  23. package/packages/agentsam-vault/package.json +8 -5
  24. package/packages/agentsam-workbench/package.json +44 -17
  25. package/packages/connectors/cloudflare/package.json +1 -1
  26. package/packages/heuristic-theme/package.json +1 -1
  27. package/packages/identity/package.json +4 -3
  28. package/packages/identity/tests/lane1-packed-consumer.test.mjs +9 -1
  29. package/packages/providers/completeful/package.json +1 -1
  30. package/packages/theme-church-site/README.md +2 -2
  31. package/packages/theme-church-site/package.json +3 -4
  32. package/packages/theme-church-site/src/index.js +1 -1
  33. package/packages/theme-church-site/test/theme.test.mjs +1 -1
  34. package/packages/theme-companions-site/README.md +2 -2
  35. package/packages/theme-companions-site/package.json +3 -4
  36. package/packages/theme-companions-site/src/index.js +1 -1
  37. package/packages/theme-companions-site/test/theme.test.mjs +1 -1
  38. package/packages/theme-floors-site/README.md +2 -2
  39. package/packages/theme-floors-site/package.json +3 -4
  40. package/packages/theme-floors-site/src/index.js +1 -1
  41. package/packages/theme-floors-site/test/theme.test.mjs +1 -1
  42. package/packages/theme-fuelnfree-site/README.md +2 -2
  43. package/packages/theme-fuelnfree-site/package.json +3 -4
  44. package/packages/theme-fuelnfree-site/src/index.js +1 -1
  45. package/packages/theme-fuelnfree-site/test/theme.test.mjs +1 -1
  46. package/packages/theme-handyman-site/README.md +2 -2
  47. package/packages/theme-handyman-site/package.json +3 -4
  48. package/packages/theme-handyman-site/src/index.js +1 -1
  49. package/packages/theme-handyman-site/test/theme.test.mjs +1 -1
  50. package/packages/theme-insurance-site/README.md +2 -2
  51. package/packages/theme-insurance-site/package.json +3 -4
  52. package/packages/theme-insurance-site/src/index.js +1 -1
  53. package/packages/theme-insurance-site/test/theme.test.mjs +1 -1
  54. package/packages/theme-scenes/package.json +1 -1
  55. package/packages/theme-shinshu-site/README.md +2 -2
  56. package/packages/theme-shinshu-site/package.json +3 -4
  57. package/packages/theme-shinshu-site/src/index.js +1 -1
  58. package/packages/theme-shinshu-site/test/theme.test.mjs +1 -1
  59. package/packages/work-graph/package.json +3 -2
  60. package/protocol/local-engine/benchmark.v1.schema.json +14 -0
  61. package/protocol/local-engine/engine.v1.schema.json +17 -0
  62. package/src/cli/command-catalog.js +1 -0
  63. package/src/cli.js +10 -0
  64. package/src/commands/app.js +10 -0
  65. package/src/commands/engine.js +10 -0
  66. package/src/commands/machine.js +71 -38
  67. package/src/commands/package.js +10 -3
  68. package/src/commands/runtime.js +25 -10
  69. package/src/commands/setup.js +30 -6
  70. package/src/commands/terminal.js +20 -8
  71. package/src/errors/contract.js +4 -4
  72. package/src/errors/diagnostic.js +1 -1
  73. package/src/errors/index.js +1 -1
  74. package/src/index.js +20 -0
  75. package/src/indexing/ingest/materials.js +237 -30
  76. package/src/lib/setup/runtime.js +4 -2
  77. package/src/local-engine/assets.js +37 -0
  78. package/src/local-engine/audit.js +133 -0
  79. package/src/local-engine/benchmark.js +26 -0
  80. package/src/local-engine/contracts.js +101 -0
  81. package/src/local-engine/engines.js +142 -0
  82. package/src/local-engine/index.js +18 -0
  83. package/src/local-engine/runtime.js +39 -0
  84. package/packages/agentsam-nav/dist/Nav.d.ts +0 -43
  85. package/packages/agentsam-nav/dist/NavCollapsible.d.ts +0 -10
  86. package/packages/agentsam-nav/dist/NavContent.d.ts +0 -2
  87. package/packages/agentsam-nav/dist/NavFooter.d.ts +0 -2
  88. package/packages/agentsam-nav/dist/NavGroup.d.ts +0 -3
  89. package/packages/agentsam-nav/dist/NavHeader.d.ts +0 -2
  90. package/packages/agentsam-nav/dist/NavMenu.d.ts +0 -22
  91. package/packages/agentsam-nav/dist/NavProvider.d.ts +0 -35
  92. package/packages/agentsam-nav/dist/NavTrigger.d.ts +0 -2
  93. package/packages/agentsam-nav/dist/Surfaces.d.ts +0 -41
  94. package/packages/agentsam-nav/dist/browser.d.ts +0 -11
  95. package/packages/agentsam-nav/dist/browser.global.js +0 -135
  96. package/packages/agentsam-nav/dist/browser.js +0 -7290
  97. package/packages/agentsam-nav/dist/contracts.d.ts +0 -76
  98. package/packages/agentsam-nav/dist/index.d.ts +0 -11
  99. package/packages/agentsam-nav/dist/index.js +0 -7291
  100. package/packages/agentsam-nav/dist/legacy.css +0 -83
  101. package/packages/agentsam-nav/dist/shell.css +0 -113
  102. package/packages/agentsam-nav/dist/theme.css +0 -113
  103. package/packages/agentsam-nav/dist/utils.d.ts +0 -1
  104. package/packages/agentsam-repository/src/goap.js.bak-20260922011251 +0 -670
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@inneranimalmedia/theme-ember",
3
- "version": "2.6.7",
4
- "description": "Real Fuel & Free Time legacy storefront pages — home, shop, about, and community.",
3
+ "version": "2.6.9",
4
+ "description": "Real Fuel & Free Time legacy storefront pages \u2014 home, shop, about, and community.",
5
5
  "type": "module",
6
6
  "main": "./src/index.js",
7
7
  "exports": {
@@ -37,6 +37,5 @@
37
37
  "type": "git",
38
38
  "url": "git+https://github.com/SamPrimeaux/agentsam-sdk.git",
39
39
  "directory": "packages/theme-fuelnfree-site"
40
- },
41
- "private": true
40
+ }
42
41
  }
@@ -8,7 +8,7 @@ const THEME = {
8
8
  "version": "0.1.0",
9
9
  "kind": "gallery-theme",
10
10
  "icon": "theme",
11
- "package": "@inneranimalmedia/theme-fuelnfree-site",
11
+ "package": "@inneranimalmedia/theme-ember",
12
12
  "category": "Commerce",
13
13
  "industries": [
14
14
  "Retail",
@@ -8,7 +8,7 @@ test('fuelnfree-site theme package exports harvested (not installable) contract'
8
8
  assert.equal(theme.installable, false);
9
9
  assert.equal(theme.lineage, "fnf");
10
10
  assert.equal(theme.family, "editorial-commerce");
11
- assert.equal(theme.package, "@inneranimalmedia/theme-fuelnfree-site");
11
+ assert.equal(theme.package, "@inneranimalmedia/theme-ember");
12
12
  assert.ok(Array.isArray(theme.pages));
13
13
  });
14
14
 
@@ -1,10 +1,10 @@
1
- # @inneranimalmedia/theme-handyman-site
1
+ # @inneranimalmedia/theme-forge
2
2
 
3
3
  Installable AgentSam theme: **Primeaux Handyman Services**.
4
4
 
5
5
  Gallery preview source: `apps/theme-gallery-preview/themes/handyman-site`.
6
6
 
7
7
  ```js
8
- import { createTheme } from "@inneranimalmedia/theme-handyman-site";
8
+ import { createTheme } from "@inneranimalmedia/theme-forge";
9
9
  const theme = createTheme();
10
10
  ```
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@inneranimalmedia/theme-forge",
3
- "version": "2.6.7",
4
- "description": "Real Primeaux Handyman PWA build — mobile-first service site with estimates and project proof.",
3
+ "version": "2.6.9",
4
+ "description": "Real Primeaux Handyman PWA build \u2014 mobile-first service site with estimates and project proof.",
5
5
  "type": "module",
6
6
  "main": "./src/index.js",
7
7
  "exports": {
@@ -37,6 +37,5 @@
37
37
  "type": "git",
38
38
  "url": "git+https://github.com/SamPrimeaux/agentsam-sdk.git",
39
39
  "directory": "packages/theme-handyman-site"
40
- },
41
- "private": true
40
+ }
42
41
  }
@@ -8,7 +8,7 @@ const THEME = {
8
8
  "version": "0.1.0",
9
9
  "kind": "gallery-theme",
10
10
  "icon": "theme",
11
- "package": "@inneranimalmedia/theme-handyman-site",
11
+ "package": "@inneranimalmedia/theme-forge",
12
12
  "category": "Services",
13
13
  "industries": [
14
14
  "Home Services",
@@ -8,7 +8,7 @@ test('handyman-site theme package exports harvested (not installable) contract',
8
8
  assert.equal(theme.installable, false);
9
9
  assert.equal(theme.lineage, "phs");
10
10
  assert.equal(theme.family, "trade-services");
11
- assert.equal(theme.package, "@inneranimalmedia/theme-handyman-site");
11
+ assert.equal(theme.package, "@inneranimalmedia/theme-forge");
12
12
  assert.ok(Array.isArray(theme.pages));
13
13
  });
14
14
 
@@ -1,10 +1,10 @@
1
- # @inneranimalmedia/theme-insurance-site
1
+ # @inneranimalmedia/theme-harbor
2
2
 
3
3
  Installable AgentSam theme: **Chrystal Clear Insurance**.
4
4
 
5
5
  Gallery preview source: `apps/theme-gallery-preview/themes/insurance-site`.
6
6
 
7
7
  ```js
8
- import { createTheme } from "@inneranimalmedia/theme-insurance-site";
8
+ import { createTheme } from "@inneranimalmedia/theme-harbor";
9
9
  const theme = createTheme();
10
10
  ```
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@inneranimalmedia/theme-harbor",
3
- "version": "2.6.7",
4
- "description": "Real Chrystal Clear Insurance build — editorial insurance storefront with coverage storytelling and quote capture.",
3
+ "version": "2.6.9",
4
+ "description": "Real Chrystal Clear Insurance build \u2014 editorial insurance storefront with coverage storytelling and quote capture.",
5
5
  "type": "module",
6
6
  "main": "./src/index.js",
7
7
  "exports": {
@@ -37,6 +37,5 @@
37
37
  "type": "git",
38
38
  "url": "git+https://github.com/SamPrimeaux/agentsam-sdk.git",
39
39
  "directory": "packages/theme-insurance-site"
40
- },
41
- "private": true
40
+ }
42
41
  }
@@ -8,7 +8,7 @@ const THEME = {
8
8
  "version": "0.1.0",
9
9
  "kind": "gallery-theme",
10
10
  "icon": "theme",
11
- "package": "@inneranimalmedia/theme-insurance-site",
11
+ "package": "@inneranimalmedia/theme-harbor",
12
12
  "category": "Professional",
13
13
  "industries": [
14
14
  "Insurance",
@@ -8,7 +8,7 @@ test('insurance-site theme package exports harvested (not installable) contract'
8
8
  assert.equal(theme.installable, false);
9
9
  assert.equal(theme.lineage, "cci");
10
10
  assert.equal(theme.family, "professional-leadgen");
11
- assert.equal(theme.package, "@inneranimalmedia/theme-insurance-site");
11
+ assert.equal(theme.package, "@inneranimalmedia/theme-harbor");
12
12
  assert.ok(Array.isArray(theme.pages));
13
13
  });
14
14
 
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inneranimalmedia/theme-scenes",
3
- "version": "2.6.7",
3
+ "version": "2.6.9",
4
4
  "description": "Reusable scene / shell / block vocabulary for branded website experiences. BrandPack owns look; theme-scenes owns composition.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -1,10 +1,10 @@
1
- # @inneranimalmedia/theme-shinshu-site
1
+ # @inneranimalmedia/theme-summit
2
2
 
3
3
  Installable AgentSam theme: **Shinshu Solutions**.
4
4
 
5
5
  Gallery preview source: `apps/theme-gallery-preview/themes/shinshu-site`.
6
6
 
7
7
  ```js
8
- import { createTheme } from "@inneranimalmedia/theme-shinshu-site";
8
+ import { createTheme } from "@inneranimalmedia/theme-summit";
9
9
  const theme = createTheme();
10
10
  ```
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@inneranimalmedia/theme-summit",
3
- "version": "2.6.7",
4
- "description": "Real Shinshu Solutions static archive — services, gallery, and CMS-ready pages.",
3
+ "version": "2.6.9",
4
+ "description": "Real Shinshu Solutions static archive \u2014 services, gallery, and CMS-ready pages.",
5
5
  "type": "module",
6
6
  "main": "./src/index.js",
7
7
  "exports": {
@@ -37,6 +37,5 @@
37
37
  "type": "git",
38
38
  "url": "git+https://github.com/SamPrimeaux/agentsam-sdk.git",
39
39
  "directory": "packages/theme-shinshu-site"
40
- },
41
- "private": true
40
+ }
42
41
  }
@@ -8,7 +8,7 @@ const THEME = {
8
8
  "version": "0.1.0",
9
9
  "kind": "gallery-theme",
10
10
  "icon": "theme",
11
- "package": "@inneranimalmedia/theme-shinshu-site",
11
+ "package": "@inneranimalmedia/theme-summit",
12
12
  "category": "Professional",
13
13
  "industries": [
14
14
  "Consulting",
@@ -8,7 +8,7 @@ test('shinshu-site theme package exports harvested (not installable) contract',
8
8
  assert.equal(theme.installable, false);
9
9
  assert.equal(theme.lineage, "shin");
10
10
  assert.equal(theme.family, "consulting-portfolio");
11
- assert.equal(theme.package, "@inneranimalmedia/theme-shinshu-site");
11
+ assert.equal(theme.package, "@inneranimalmedia/theme-summit");
12
12
  assert.ok(Array.isArray(theme.pages));
13
13
  });
14
14
 
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inneranimalmedia/agentsam-work-graph",
3
- "version": "2.6.7",
3
+ "version": "2.6.9",
4
4
  "description": "Core AgentSam work-graph primitive: one graph model (WorkItem, Dependency, TimelineEvent, Artifact, Evidence, Actor) powering an engineering adapter (git/MCP/tests/deploys) and a business adapter (projects/clients/approvals/milestones), with Gantt/timeline rendering as a pure projection over the graph rather than its own source of truth.",
5
5
  "type": "module",
6
6
  "main": "./src/index.js",
@@ -25,5 +25,6 @@
25
25
  },
26
26
  "files": [
27
27
  "src"
28
- ]
28
+ ],
29
+ "license": "MIT"
29
30
  }
@@ -0,0 +1,14 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "agentsam.engine.benchmark.v1",
4
+ "type": "object",
5
+ "required": ["schema_version", "engine_id", "runs", "summary"],
6
+ "properties": {
7
+ "schema_version": { "const": "agentsam.engine.benchmark.v1" },
8
+ "engine_id": { "type": "string" },
9
+ "model": { "type": ["string", "null"] },
10
+ "runs": { "type": "array" },
11
+ "summary": { "type": "object" },
12
+ "resource": { "type": "object" }
13
+ }
14
+ }
@@ -0,0 +1,17 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "agentsam.local-engine.v1",
4
+ "type": "object",
5
+ "required": ["schema_version", "engine_id", "status", "capabilities"],
6
+ "properties": {
7
+ "schema_version": { "const": "agentsam.local-engine.v1" },
8
+ "engine_id": { "type": "string", "minLength": 1 },
9
+ "version": { "type": ["string", "null"] },
10
+ "model": { "type": ["string", "null"] },
11
+ "status": { "enum": ["installed", "available", "unavailable", "unknown", "completed", "unsupported"] },
12
+ "capabilities": { "type": "object", "additionalProperties": { "type": "boolean" } },
13
+ "evidence": { "type": "array" },
14
+ "warnings": { "type": "array", "items": { "type": "string" } }
15
+ },
16
+ "additionalProperties": true
17
+ }
@@ -14,6 +14,7 @@ export const CLI_COMMAND_CATALOG = Object.freeze([
14
14
  { id: 'dev', summary: 'Run this project’s npm dev script', topic: 'work', skill: 'agentsam-app-fundamentals' },
15
15
  { id: 'inspect', summary: 'Bounded repository inspect / authority view', topic: 'work', skill: 'agentsam-app-fundamentals', operation: 'repository.inspect', common: true },
16
16
  { id: 'machine', summary: 'Deterministic local machine perception (inspect / asset discovery)', topic: 'work', skill: 'agentsam-app-fundamentals', operation: 'machine.inspect', common: true },
17
+ { id: 'engine', summary: 'Discover, audit, benchmark, and govern local AI engines', topic: 'runtime', skill: 'agentsam-app-fundamentals', operation: 'engine.audit', common: true },
17
18
  { id: 'package', summary: 'Audit, verify, and plan publication of distributable packages', topic: 'work', skill: 'agentsam-progression-guard', operation: 'package.audit', common: true, usage: ['agentsam package audit [--public] [--offline] [--json]', 'agentsam package status <name> [--offline] [--json]', 'agentsam package verify <name> [--offline] [--json]', 'agentsam package publish-plan [--offline] [--json]'] },
18
19
  { id: 'capabilities', summary: 'Inspect capability contracts', topic: 'create', skill: 'agentsam-app-fundamentals' },
19
20
  {
package/src/cli.js CHANGED
@@ -36,6 +36,7 @@ import { runPackage } from './commands/package.js';
36
36
  import { runRecon } from './commands/recon.js';
37
37
  import { runCad } from './commands/cad.js';
38
38
  import { runMachine } from './commands/machine.js';
39
+ import { runEngine } from './commands/engine.js';
39
40
  import { runSkills } from './commands/skills.js';
40
41
  import { runSkill } from './commands/skill.js';
41
42
  import { runEval } from './commands/eval.js';
@@ -99,6 +100,7 @@ function printLegacyHelp() {
99
100
  agentsam dev Run this project's existing npm dev script
100
101
  agentsam inspect [--json] Bounded repository index by default; use --view full for authority envelope
101
102
  agentsam machine inspect Native deterministic perception + asset discovery (--json)
103
+ agentsam engine status|audit|benchmark|assets Local AI engine + compute tooling
102
104
  agentsam brand [scan|…] Deterministic brand intelligence on repository.snapshot authority
103
105
  agentsam plan brand Composable brand normalization plan (--goap optional)
104
106
  agentsam deploy Graduate an AgentSam project intentionally
@@ -454,6 +456,14 @@ if (command === '--version' || command === '-v') {
454
456
  } else if (command === 'inspect') {
455
457
  try { await runInspect(rest); }
456
458
  catch (e) { reportCliError(e); process.exitCode = 1; }
459
+ } else if (command === 'engine') {
460
+ try {
461
+ const code = await runEngine(rest);
462
+ if (typeof code === 'number' && code !== 0) process.exitCode = code;
463
+ } catch (e) {
464
+ reportCliError(e);
465
+ process.exitCode = e?.exitCode || 1;
466
+ }
457
467
  } else if (command === 'machine') {
458
468
  try {
459
469
  const code = await runMachine(rest);
@@ -365,6 +365,7 @@ export async function runApp(argv = [], options = {}) {
365
365
  'agentsam app doctor <id>',
366
366
  'agentsam app preview <id>',
367
367
  'agentsam app scaffold <id> <dir>',
368
+ 'agentsam app package <id> [--dry-run]',
368
369
  '',
369
370
  ].join('\n'));
370
371
  return;
@@ -424,6 +425,15 @@ export async function runApp(argv = [], options = {}) {
424
425
  write(' app_id is stable product identity. Pass --app-id explicitly; no AGENTSAM_DEFAULT_APP.\n\n');
425
426
  return { id: app.id, curl, command: npmCmd };
426
427
  }
428
+ if (command === 'package') {
429
+ const dryRun = rest.includes('--dry-run') || !rest.includes('--write');
430
+ const packArgs = ['pack', ...(dryRun ? ['--dry-run', '--ignore-scripts'] : []), '--json'];
431
+ const result = spawnSync('npm', packArgs, { cwd: app.dir, encoding: 'utf8', env: process.env });
432
+ if (result.status !== 0) throw new Error(String(result.stderr || result.stdout || `npm pack failed for ${app.id}`).trim());
433
+ const metadata = JSON.parse(result.stdout)[0];
434
+ write(`${JSON.stringify({ app_id: app.id, package: metadata.name, version: metadata.version, filename: metadata.filename, size: metadata.size, dry_run: dryRun }, null, 2)}\n`);
435
+ return metadata;
436
+ }
427
437
  if (command === 'doctor' || command === 'preview') {
428
438
  runAppBin(app, [command, ...rest], options);
429
439
  return;
@@ -0,0 +1,10 @@
1
+ import path from 'node:path';
2
+ import { createLocalEngineRegistry } from '../local-engine/index.js';
3
+ import { auditLocalCompute } from '../local-engine/audit.js';
4
+ import { auditAssets } from '../local-engine/assets.js';
5
+ import { benchmarkEngine } from '../local-engine/benchmark.js';
6
+
7
+ function parse(argv = []) { const out = { action: argv[0] || 'status', engine: null, model: null, json: argv.includes('--json'), runs: 1, cwd: process.cwd() }; for (let i = 1; i < argv.length; i += 1) { const arg = argv[i]; if (arg === '--model') out.model = argv[++i]; else if (arg === '--runs') out.runs = Number(argv[++i]) || 1; else if (arg === '--cwd') out.cwd = path.resolve(argv[++i] || out.cwd); else if (arg === '--engine') out.engine = argv[++i]; } return out; }
8
+ function emit(value, json) { if (json) console.log(JSON.stringify(value)); else console.log(JSON.stringify(value, null, 2)); }
9
+ function usage() { return `agentsam engine <status|audit|benchmark|assets> [options]\n\n status Discover local engines and models\n audit Read-only Apple hardware + engine inventory\n benchmark Measure a selected engine/model\n assets audit Audit adopted model references without copying weights\n\n --engine <id> ollama | mlx-lm | llama.cpp\n --model <id> Engine model identifier\n --runs <n> Benchmark repetitions (default 1)\n --cwd <path> Project context\n --json Machine-readable output\n`; }
10
+ export async function runEngine(argv = []) { const args = parse(argv); if (args.action === '--help' || args.action === 'help') { console.log(usage()); return 0; } const registry = createLocalEngineRegistry(); if (args.action === 'status') { emit({ schema_version: 'agentsam.local-engine.v1', engines: await registry.discover() }, args.json); return 0; } if (args.action === 'audit') { emit(auditLocalCompute(), args.json); return 0; } if (args.action === 'assets' && argv[1] === 'audit') { emit(auditAssets(), args.json); return 0; } if (args.action === 'benchmark') { if (!args.engine || !args.model) throw new Error('engine benchmark requires --engine <id> and --model <id>'); const result = await benchmarkEngine(registry.get(args.engine), { model: args.model, runs: args.runs }); emit(result, args.json); return 0; } console.log(usage()); return 1; }
@@ -2,7 +2,9 @@
2
2
  * agentsam machine — deterministic native Machine lifecycle + perception.
3
3
  */
4
4
 
5
+ import os from 'node:os';
5
6
  import path from 'node:path';
7
+ import pc from 'picocolors';
6
8
  import { resolveMachineBinary, spawnMachine } from './machine-binary.js';
7
9
  import {
8
10
  installManagedMachine,
@@ -12,23 +14,35 @@ import {
12
14
  } from './machine-runtime.js';
13
15
 
14
16
  function usage() {
15
- return 'agentsam machine — deterministic local perception (native engine)\n\n' +
16
- 'Usage:\n' +
17
- ' agentsam machine status [--json]\n' +
18
- ' agentsam machine doctor [--json]\n' +
19
- ' agentsam machine install [--version <semver>] [--force] [--json]\n' +
20
- ' agentsam machine update [--force] [--json]\n' +
21
- ' agentsam machine inspect <path> [--json] [--run-id <id>] [--include-generated]\n' +
22
- ' agentsam machine --help\n\n' +
23
- 'Runtime authority:\n' +
24
- ' AgentSam manages one user-level Machine runtime under ~/.agentsam/runtimes/machine/.\n' +
25
- ' Every repository uses that managed runtime first; PATH and SDK source are fallbacks only.\n' +
26
- ' Install/update are explicit and never run merely because you entered a repository.\n\n' +
27
- 'Notes:\n' +
28
- ' Default inspect is read-only and network-free.\n' +
29
- ' Large detail is externalized under <target>/.agentsam/machine/runs/<run_id>/.\n' +
30
- ' Generated/cache trees are summarized unless --include-generated is set.\n' +
31
- ' Current registry distribution uses crates.io and therefore requires Cargo for install/update.\n';
17
+ return [
18
+ `${pc.bold('agentsam machine')} — deterministic local perception (native engine)`,
19
+ '',
20
+ pc.bold('Usage'),
21
+ ` ${pc.cyan('agentsam machine status')} Show the active runtime`,
22
+ ` ${pc.cyan('agentsam machine doctor')} Diagnose runtime resolution`,
23
+ ` ${pc.cyan('agentsam machine install')} [--version <semver>] Install the managed runtime`,
24
+ ` ${pc.cyan('agentsam machine update')} Update the managed runtime`,
25
+ ` ${pc.cyan('agentsam machine inspect <path>')} Inspect a repository or directory`,
26
+ '',
27
+ pc.bold('Options'),
28
+ ` ${pc.dim('--json')} Machine-readable output`,
29
+ ` ${pc.dim('--force')} Replace an existing managed version`,
30
+ ` ${pc.dim('--run-id <id>')} Reuse an externalized inspection run`,
31
+ ` ${pc.dim('--include-generated')} Include generated and cache trees`,
32
+ ` ${pc.dim('--help')} Show this help`,
33
+ '',
34
+ pc.bold('Runtime authority'),
35
+ ' AgentSam manages one user-level Machine runtime under ~/.agentsam/runtimes/machine/.',
36
+ ' Resolution order: managed runtime → explicit override → PATH → SDK source.',
37
+ ' Install and update are explicit; entering a repository never changes the host.',
38
+ '',
39
+ pc.bold('Behavior'),
40
+ ' Inspect is read-only and network-free by default.',
41
+ ' Large detail is externalized under <target>/.agentsam/machine/runs/<run_id>/.',
42
+ ' Generated and cache trees are summarized unless --include-generated is set.',
43
+ ' Install/update use the crates.io distribution and require Cargo.',
44
+ '',
45
+ ].join('\n');
32
46
  }
33
47
 
34
48
  function parseArgs(argv = []) {
@@ -86,44 +100,63 @@ function statusPayload() {
86
100
  };
87
101
  }
88
102
 
103
+ function compactPath(value) {
104
+ const raw = String(value || '—');
105
+ const home = os.homedir();
106
+ return home && (raw === home || raw.startsWith(home + path.sep))
107
+ ? '~' + raw.slice(home.length)
108
+ : raw;
109
+ }
110
+
111
+ function stateLabel(installed) {
112
+ return installed ? pc.green('installed') : pc.yellow('not installed');
113
+ }
114
+
89
115
  function printTextStatus(payload) {
90
- console.log('AgentSam Machine');
116
+ const managed = payload.managed;
117
+ const effective = payload.effective;
118
+ console.log(pc.bold('AgentSam Machine'));
119
+ console.log(pc.dim('Deterministic local perception · native runtime'));
120
+ console.log('');
121
+ console.log(pc.bold('Managed runtime'));
122
+ console.log(` status ${stateLabel(managed.installed)}`);
123
+ console.log(` version ${managed.current_version || pc.dim('—')}`);
124
+ console.log(` runtime ${compactPath(managed.runtime_root)}`);
125
+ console.log(` binary ${compactPath(managed.binary)}`);
91
126
  console.log('');
92
- console.log(' managed ' + (payload.managed.installed ? 'installed' : 'not installed'));
93
- console.log(' version ' + (payload.managed.current_version || '—'));
94
- console.log(' binary ' + (payload.managed.binary || '—'));
95
- console.log(' runtime ' + payload.managed.runtime_root);
96
- console.log(' effective ' + payload.effective.source);
97
- console.log(' effective v ' + (payload.effective.version || 'unknown'));
98
- console.log(' cargo ' + (payload.managed.cargo.available ? payload.managed.cargo.path : 'not found'));
99
- if (!payload.managed.installed) {
127
+ console.log(pc.bold('Active resolution'));
128
+ console.log(` source ${effective.source || pc.dim('unavailable')}`);
129
+ console.log(` version ${effective.version || pc.dim('unknown')}`);
130
+ console.log(` cargo ${managed.cargo.available ? compactPath(managed.cargo.path) : pc.dim('not found')}`);
131
+ if (!managed.installed) {
100
132
  console.log('');
101
- console.log(' Run agentsam machine install to adopt the user-managed runtime.');
133
+ console.log(` ${pc.yellow('Next step')} agentsam machine install`);
102
134
  }
103
135
  }
104
136
 
105
137
  function printTextDoctor(payload) {
106
138
  printTextStatus(payload);
107
139
  console.log('');
140
+ console.log(pc.bold('Doctor'));
108
141
  if (payload.effective.kind === 'missing') {
109
- console.log(' ✕ Machine unavailable');
110
- console.log(' tried ' + (payload.effective.tried || []).join(', '));
142
+ console.log(` ${pc.red('✕')} Machine unavailable`);
143
+ console.log(` tried ${(payload.effective.tried || []).map(compactPath).join(', ') || pc.dim('none')}`);
111
144
  } else if (payload.managed.installed) {
112
- console.log(' ✓ managed Machine runtime is available');
145
+ console.log(` ${pc.green('✓')} Managed Machine runtime is available`);
113
146
  } else {
114
- console.log(' ○ Machine works through fallback source: ' + payload.effective.source);
115
- console.log(' ○ install the managed runtime to make resolution consistent across repositories');
147
+ console.log(` ${pc.yellow('○')} Fallback runtime is active: ${payload.effective.source}`);
148
+ console.log(' install the managed runtime for consistent resolution across repositories');
116
149
  }
117
150
  }
118
151
 
119
152
  function printInstallResult(action, result) {
120
- console.log('AgentSam Machine ' + action);
153
+ console.log(pc.bold(`AgentSam Machine · ${action}`));
121
154
  console.log('');
122
- console.log(' version ' + result.version);
123
- console.log(' binary ' + result.binary);
124
- console.log(' alias ' + result.alias);
125
- console.log(' source ' + result.source);
126
- console.log(' changed ' + (result.changed ? 'yes' : 'no'));
155
+ console.log(` ${pc.green('✓')} Runtime ${result.changed ? 'installed' : 'already current'}`);
156
+ console.log(` version ${result.version}`);
157
+ console.log(` source ${result.source}`);
158
+ console.log(` binary ${compactPath(result.binary)}`);
159
+ console.log(` alias ${compactPath(result.alias)}`);
127
160
  }
128
161
 
129
162
  export async function runMachine(argv = []) {
@@ -3,6 +3,7 @@ import path from 'node:path';
3
3
  import { execFile, spawnSync } from 'node:child_process';
4
4
  import { promisify } from 'node:util';
5
5
  import { fileURLToPath } from 'node:url';
6
+ import { findCliProjectRoot } from '../lib/cli-preferences.js';
6
7
 
7
8
  const execFileAsync = promisify(execFile);
8
9
  const SDK_ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '../..');
@@ -403,6 +404,10 @@ function parseArgs(argv) {
403
404
  return { positional, flags };
404
405
  }
405
406
 
407
+ export function resolvePackageRoot(cwd = process.cwd()) {
408
+ return findCliProjectRoot(cwd);
409
+ }
410
+
406
411
  function printHelp() {
407
412
  console.log(`agentsam package — audit and graduate distributable packages
408
413
 
@@ -474,6 +479,7 @@ export async function runPackage(argv = []) {
474
479
  const sub = positional[0];
475
480
  const json = flags.has('--json');
476
481
  const offline = flags.has('--offline');
482
+ const root = resolvePackageRoot(process.cwd());
477
483
 
478
484
  if (!sub || flags.has('--help') || flags.has('-h')) {
479
485
  printHelp();
@@ -482,6 +488,7 @@ export async function runPackage(argv = []) {
482
488
 
483
489
  if (sub === 'audit') {
484
490
  const report = await auditPackages({
491
+ root,
485
492
  publicOnly: flags.has('--public'),
486
493
  offline,
487
494
  });
@@ -495,7 +502,7 @@ export async function runPackage(argv = []) {
495
502
  const name = positional[1];
496
503
  if (!name) throw new Error('package status requires a package name');
497
504
 
498
- const pkg = collectPackageManifests().find((item) => item.name === name);
505
+ const pkg = collectPackageManifests(root).find((item) => item.name === name);
499
506
  if (!pkg) throw new Error(`Unknown @inneranimalmedia package: ${name}`);
500
507
 
501
508
  const status = classifyPackage(pkg, await registryLookup(pkg, offline));
@@ -509,7 +516,7 @@ export async function runPackage(argv = []) {
509
516
  const name = positional[1];
510
517
  if (!name) throw new Error('package verify requires a package name');
511
518
 
512
- const report = await verifyPackage(name, { offline });
519
+ const report = await verifyPackage(name, { root, offline });
513
520
 
514
521
  if (json) console.log(JSON.stringify(report, null, 2));
515
522
  else printVerify(report);
@@ -519,7 +526,7 @@ export async function runPackage(argv = []) {
519
526
  }
520
527
 
521
528
  if (sub === 'publish-plan') {
522
- const plan = await buildPublishPlan({ offline });
529
+ const plan = await buildPublishPlan({ root, offline });
523
530
 
524
531
  if (json) console.log(JSON.stringify(plan, null, 2));
525
532
  else printPlan(plan);
@@ -101,6 +101,15 @@ async function probeAgentsamd() {
101
101
  }
102
102
  }
103
103
 
104
+ async function waitForAgentsamd({ attempts = 8, delayMs = 250 } = {}) {
105
+ let last = await probeAgentsamd();
106
+ for (let attempt = 1; attempt < attempts && !last.ok; attempt += 1) {
107
+ await new Promise((resolve) => setTimeout(resolve, delayMs));
108
+ last = await probeAgentsamd();
109
+ }
110
+ return last;
111
+ }
112
+
104
113
  async function startAgentsamd(home, write) {
105
114
  const bin = agentsamdPath(home);
106
115
  if (!fs.existsSync(bin)) throw new Error('agentsamd_not_installed');
@@ -109,8 +118,7 @@ async function startAgentsamd(home, write) {
109
118
  try {
110
119
  await startWindowsScheduledTask();
111
120
  writeLine(write, ` Started Scheduled Task · ${listenAddr()}`);
112
- await new Promise((r) => setTimeout(r, 600));
113
- return probeAgentsamd();
121
+ return waitForAgentsamd();
114
122
  } catch (err) {
115
123
  writeLine(write, ` ○ Scheduled Task start failed (${err.message || err}); falling back to spawn`);
116
124
  }
@@ -122,8 +130,7 @@ async function startAgentsamd(home, write) {
122
130
  const boot = await bootstrapDarwinLaunchAgent(plist);
123
131
  if (boot.ok) {
124
132
  writeLine(write, ` Loaded LaunchAgent ${DARWIN_LAUNCH_LABEL}`);
125
- await new Promise((r) => setTimeout(r, 400));
126
- return probeAgentsamd();
133
+ return waitForAgentsamd();
127
134
  }
128
135
  }
129
136
  }
@@ -138,8 +145,7 @@ async function startAgentsamd(home, write) {
138
145
  ensureRuntimeStateDir(home);
139
146
  fs.writeFileSync(pidPath(home), String(child.pid));
140
147
  writeLine(write, ` Started agentsamd pid ${child.pid} · ${listenAddr()}`);
141
- await new Promise((r) => setTimeout(r, 400));
142
- return probeAgentsamd();
148
+ return waitForAgentsamd();
143
149
  }
144
150
 
145
151
  async function stopAgentsamd(home, write) {
@@ -218,12 +224,21 @@ export async function runRuntime(argv = [], options = {}) {
218
224
  writeLine(write, ` Impl ${probe.body.implementation}`);
219
225
  }
220
226
  writeLine(write, '');
221
- writeLine(write, ' Next');
222
- writeLine(write, ' agentsam setup runtime');
223
- writeLine(write, ' agentsam runtime install --yes');
227
+ if (probe.ok) {
228
+ writeLine(write, sub === 'doctor' ? ' Doctor ✓ healthy; no repair needed' : ' State ✓ ready');
229
+ writeLine(write, ' Next agentsam terminal --help');
230
+ } else if (facts.agentsamd.installed) {
231
+ writeLine(write, ' Repair');
232
+ writeLine(write, ' agentsam runtime start');
233
+ writeLine(write, ' agentsam runtime install --yes # rebuild only if start still fails');
234
+ } else {
235
+ writeLine(write, ' Next');
236
+ writeLine(write, ' agentsam setup runtime');
237
+ writeLine(write, ' agentsam runtime install --yes');
238
+ }
224
239
  writeLine(write, '');
225
240
  }
226
- return probe.ok || facts.agentsamd.installed ? 0 : (sub === 'doctor' ? 2 : 0);
241
+ return sub === 'doctor' ? (probe.ok ? 0 : 2) : 0;
227
242
  }
228
243
 
229
244
  if (sub === 'probe') {