@skrr-ai/cli 0.1.49 → 0.1.50

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 (101) hide show
  1. package/README.md +5 -4
  2. package/dist/base-command.js +16 -4
  3. package/dist/commands/agents/create.js +14 -7
  4. package/dist/commands/agents/update.js +11 -5
  5. package/dist/commands/code/index.d.ts +1 -0
  6. package/dist/commands/code/index.js +49 -5
  7. package/dist/commands/code/run.js +5 -1
  8. package/dist/commands/commitments/cycles.d.ts +19 -0
  9. package/dist/commands/commitments/cycles.js +46 -0
  10. package/dist/commands/commitments/effective-policy.js +26 -1
  11. package/dist/commands/commitments/explain.d.ts +17 -0
  12. package/dist/commands/commitments/explain.js +40 -0
  13. package/dist/commands/goals/create.d.ts +1 -0
  14. package/dist/commands/goals/create.js +22 -0
  15. package/dist/commands/logout.js +12 -1
  16. package/dist/commands/machines/dedicated/index.js +1 -1
  17. package/dist/commands/machines/dedicated/sign-in.js +4 -1
  18. package/dist/commands/machines/dedicated/terminal/kill.d.ts +21 -0
  19. package/dist/commands/machines/dedicated/terminal/kill.js +55 -0
  20. package/dist/commands/machines/dedicated/terminal/ls.d.ts +22 -0
  21. package/dist/commands/machines/dedicated/terminal/ls.js +70 -0
  22. package/dist/commands/machines/dedicated/terminal/rename.d.ts +23 -0
  23. package/dist/commands/machines/dedicated/terminal/rename.js +64 -0
  24. package/dist/commands/machines/dedicated/terminal.d.ts +9 -0
  25. package/dist/commands/machines/dedicated/terminal.js +27 -2
  26. package/dist/commands/machines/hosted/connect.js +2 -2
  27. package/dist/commands/machines/hosted/destroy.js +1 -1
  28. package/dist/commands/machines/hosted/exec.js +1 -1
  29. package/dist/commands/machines/hosted/list.js +1 -1
  30. package/dist/commands/machines/hosted/pause.js +1 -1
  31. package/dist/commands/machines/hosted/pull.js +1 -1
  32. package/dist/commands/machines/hosted/resume.js +1 -1
  33. package/dist/commands/machines/hosted/start.js +2 -2
  34. package/dist/commands/machines/hosted/status.js +2 -1
  35. package/dist/commands/tasks/create.js +1 -0
  36. package/dist/commands/tasks/list.js +1 -0
  37. package/dist/commands/tasks/update.js +1 -0
  38. package/dist/lib/agent-config.d.ts +2 -0
  39. package/dist/lib/agent-config.js +3 -1
  40. package/dist/lib/api-fetch.js +19 -0
  41. package/dist/lib/auth-storage.d.ts +14 -0
  42. package/dist/lib/auth-storage.js +14 -0
  43. package/dist/lib/commitments.d.ts +17 -2
  44. package/dist/lib/commitments.js +114 -0
  45. package/dist/lib/daemonBroker.d.ts +120 -31
  46. package/dist/lib/daemonBroker.js +313 -20
  47. package/dist/lib/dedicated-lease-command.d.ts +14 -0
  48. package/dist/lib/dedicated-lease-command.js +30 -1
  49. package/dist/lib/dedicated-machines.js +8 -25
  50. package/dist/lib/dedicated-service-command.d.ts +11 -3
  51. package/dist/lib/dedicated-service-command.js +20 -3
  52. package/dist/lib/dedicated-service.d.ts +46 -0
  53. package/dist/lib/dedicated-service.js +85 -7
  54. package/dist/lib/dedicated-terminal.d.ts +21 -0
  55. package/dist/lib/dedicated-terminal.js +104 -9
  56. package/dist/lib/first-party-harness-broker.d.ts +10 -0
  57. package/dist/lib/first-party-harness-broker.js +9 -0
  58. package/dist/lib/first-party-harness-doctor.js +41 -1
  59. package/dist/lib/first-party-harness-managed.d.ts +4 -3
  60. package/dist/lib/first-party-harness-project-trust.d.ts +125 -0
  61. package/dist/lib/first-party-harness-project-trust.js +364 -0
  62. package/dist/lib/first-party-harness.d.ts +9 -2
  63. package/dist/lib/first-party-harness.js +6 -5
  64. package/dist/lib/hosted-machines.d.ts +10 -1
  65. package/dist/lib/hosted-machines.js +36 -2
  66. package/dist/lib/login.js +16 -0
  67. package/dist/lib/machine-spend-cap.d.ts +23 -0
  68. package/dist/lib/machine-spend-cap.js +68 -0
  69. package/dist/lib/node-adapter.js +15 -3
  70. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/cliHandoffWire.d.ts +90 -0
  71. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/cliHandoffWire.js +113 -0
  72. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/credentialSession.d.ts +47 -0
  73. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/credentialSession.js +69 -0
  74. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/daemonToolApproval.d.ts +109 -0
  75. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/daemonToolApproval.js +171 -0
  76. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/messages.d.ts +8 -3
  77. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/messages.js +9 -4
  78. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/refresh.js +8 -9
  79. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/refreshClassification.d.ts +6 -0
  80. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/refreshClassification.js +32 -9
  81. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/sessionPermissionAuthority.d.ts +81 -0
  82. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/sessionPermissionAuthority.js +87 -0
  83. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/types.d.ts +6 -1
  84. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/cliHandoffWire.d.ts +90 -0
  85. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/cliHandoffWire.js +105 -0
  86. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/credentialSession.d.ts +47 -0
  87. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/credentialSession.js +66 -0
  88. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/daemonToolApproval.d.ts +109 -0
  89. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/daemonToolApproval.js +164 -0
  90. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/messages.d.ts +8 -3
  91. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/messages.js +9 -4
  92. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/refresh.js +8 -9
  93. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/refreshClassification.d.ts +6 -0
  94. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/refreshClassification.js +31 -9
  95. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/sessionPermissionAuthority.d.ts +81 -0
  96. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/sessionPermissionAuthority.js +80 -0
  97. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/types.d.ts +6 -1
  98. package/dist/node_modules/@skrr-ai/auth-core/package.json +40 -0
  99. package/dist/node_modules/@skrr-ai/data-provider/index.js +3413 -3343
  100. package/oclif.manifest.json +15769 -15342
  101. package/package.json +4 -1
@@ -0,0 +1,81 @@
1
+ /**
2
+ * Session permission authority — the ONE rule that decides whether a session's
3
+ * execution contract governs the run's permissions, shared by the server and
4
+ * the daemon (OSK-11975 introduced it; it was implemented twice — the server
5
+ * read `kind !== 'commitment'`, the daemon read the `permissionSource` marker —
6
+ * which is exactly how a new contract kind or a new source value would drift
7
+ * them apart).
8
+ *
9
+ * The wire model:
10
+ *
11
+ * - The contract is closed (`hasOnlyKeys` on the daemon), so "whose
12
+ * permissions govern" can never ride INSIDE it. It is a top-level session
13
+ * field: `permissionSource`.
14
+ * - `'agent'` means the Agent's own configured permission mode, tool policy,
15
+ * Grants, session env, MCP servers and machine consent govern the run,
16
+ * exactly as for an unattended Task of the same Agent. Today only a
17
+ * `commitment` contract may carry it.
18
+ * - A `commitment` contract WITHOUT the marker (an older server mid-deploy)
19
+ * still governs permissions — the marker is the version signal, so its
20
+ * absence must keep the legacy fence, not silently lift it.
21
+ * - `task_delivery` contracts always govern, marker or not.
22
+ *
23
+ * Server vs daemon asymmetry, on purpose: the server STAMPS the marker
24
+ * (`permissionSourceForContract`), so on its own side the predicate reduces to
25
+ * "a commitment never governs" — `contractGovernsPermissions(c,
26
+ * permissionSourceForContract(c))` is exactly `kind !== 'commitment'`. The
27
+ * daemon reads the marker it received, because it cannot distinguish "new
28
+ * server, agent permissions" from "old server, contract fence" any other way.
29
+ * Both call the same function; only the input differs.
30
+ */
31
+ /** The wire vocabulary for `permissionSource`. Top-level session field. */
32
+ export declare const SESSION_PERMISSION_SOURCES: readonly ["agent"];
33
+ export type SessionPermissionSource = (typeof SESSION_PERMISSION_SOURCES)[number];
34
+ /**
35
+ * The daemon capability that proves a build honours `permissionSource`. The
36
+ * server announces it in preflight and refuses to dispatch a Commitment Run to
37
+ * a daemon without it (`COMMITMENT_AGENT_PERMISSIONS_RUNTIME_UNSUPPORTED`), so
38
+ * the marker never reaches a daemon that would ignore it.
39
+ */
40
+ export declare const COMMITMENT_AGENT_PERMISSIONS_CAPABILITY = "commitment_execution_contract_v2_agent_permissions";
41
+ /**
42
+ * The minimal contract shape this rule reads. The predicate only ever needs
43
+ * `kind` — keeping the input structural means this module never imports the
44
+ * full `CommitmentExecutionContract` type, which lives daemon-side
45
+ * (`daemon/src/commitment-execution-contract.ts`) and server-side in the
46
+ * commitment services.
47
+ */
48
+ export type PermissionContractKind = {
49
+ kind?: unknown;
50
+ } | null | undefined;
51
+ /**
52
+ * Untrusted wire input: anything but an exact vocabulary literal reads as
53
+ * absent. Never widen by coercion — an unrecognized future value must degrade
54
+ * to "contract governs", the conservative answer.
55
+ */
56
+ export declare function normalizeSessionPermissionSource(value: unknown): SessionPermissionSource | undefined;
57
+ /**
58
+ * What the server stamps on the wire for this contract. A `commitment`
59
+ * contract no longer carries permissions (OSK-11975); every other contract
60
+ * kind keeps its own authority and stamps nothing.
61
+ */
62
+ export declare function permissionSourceForContract(contract: PermissionContractKind): SessionPermissionSource | undefined;
63
+ /**
64
+ * Whether the contract is the run's PERMISSION authority — the single place
65
+ * this rule lives.
66
+ *
67
+ * True for a non-commitment contract regardless of marker, and for a
68
+ * commitment whose server did not declare agent permissions. False for no
69
+ * contract at all, and for a commitment carrying `permissionSource: 'agent'`,
70
+ * which then follows the Agent's own permissions exactly as a Task does while
71
+ * the contract keeps its non-permission roles (normalized shape, ephemeral
72
+ * worktree, result validation, `GIT_OPTIONAL_LOCKS`, provider restriction).
73
+ */
74
+ export declare function contractGovernsPermissions(contract: PermissionContractKind, permissionSource: unknown): boolean;
75
+ /**
76
+ * The contract when it governs permissions, else `undefined` — for the sites
77
+ * that used `executionContract` as "is this run permission-fenced".
78
+ */
79
+ export declare function permissionGoverningContract<T extends {
80
+ kind?: unknown;
81
+ }>(contract: T | null | undefined, permissionSource: unknown): T | undefined;
@@ -0,0 +1,80 @@
1
+ /**
2
+ * Session permission authority — the ONE rule that decides whether a session's
3
+ * execution contract governs the run's permissions, shared by the server and
4
+ * the daemon (OSK-11975 introduced it; it was implemented twice — the server
5
+ * read `kind !== 'commitment'`, the daemon read the `permissionSource` marker —
6
+ * which is exactly how a new contract kind or a new source value would drift
7
+ * them apart).
8
+ *
9
+ * The wire model:
10
+ *
11
+ * - The contract is closed (`hasOnlyKeys` on the daemon), so "whose
12
+ * permissions govern" can never ride INSIDE it. It is a top-level session
13
+ * field: `permissionSource`.
14
+ * - `'agent'` means the Agent's own configured permission mode, tool policy,
15
+ * Grants, session env, MCP servers and machine consent govern the run,
16
+ * exactly as for an unattended Task of the same Agent. Today only a
17
+ * `commitment` contract may carry it.
18
+ * - A `commitment` contract WITHOUT the marker (an older server mid-deploy)
19
+ * still governs permissions — the marker is the version signal, so its
20
+ * absence must keep the legacy fence, not silently lift it.
21
+ * - `task_delivery` contracts always govern, marker or not.
22
+ *
23
+ * Server vs daemon asymmetry, on purpose: the server STAMPS the marker
24
+ * (`permissionSourceForContract`), so on its own side the predicate reduces to
25
+ * "a commitment never governs" — `contractGovernsPermissions(c,
26
+ * permissionSourceForContract(c))` is exactly `kind !== 'commitment'`. The
27
+ * daemon reads the marker it received, because it cannot distinguish "new
28
+ * server, agent permissions" from "old server, contract fence" any other way.
29
+ * Both call the same function; only the input differs.
30
+ */
31
+ /** The wire vocabulary for `permissionSource`. Top-level session field. */
32
+ export const SESSION_PERMISSION_SOURCES = ['agent'];
33
+ /**
34
+ * The daemon capability that proves a build honours `permissionSource`. The
35
+ * server announces it in preflight and refuses to dispatch a Commitment Run to
36
+ * a daemon without it (`COMMITMENT_AGENT_PERMISSIONS_RUNTIME_UNSUPPORTED`), so
37
+ * the marker never reaches a daemon that would ignore it.
38
+ */
39
+ export const COMMITMENT_AGENT_PERMISSIONS_CAPABILITY = 'commitment_execution_contract_v2_agent_permissions';
40
+ /**
41
+ * Untrusted wire input: anything but an exact vocabulary literal reads as
42
+ * absent. Never widen by coercion — an unrecognized future value must degrade
43
+ * to "contract governs", the conservative answer.
44
+ */
45
+ export function normalizeSessionPermissionSource(value) {
46
+ return SESSION_PERMISSION_SOURCES.includes(value)
47
+ ? value
48
+ : undefined;
49
+ }
50
+ /**
51
+ * What the server stamps on the wire for this contract. A `commitment`
52
+ * contract no longer carries permissions (OSK-11975); every other contract
53
+ * kind keeps its own authority and stamps nothing.
54
+ */
55
+ export function permissionSourceForContract(contract) {
56
+ return contract?.kind === 'commitment' ? 'agent' : undefined;
57
+ }
58
+ /**
59
+ * Whether the contract is the run's PERMISSION authority — the single place
60
+ * this rule lives.
61
+ *
62
+ * True for a non-commitment contract regardless of marker, and for a
63
+ * commitment whose server did not declare agent permissions. False for no
64
+ * contract at all, and for a commitment carrying `permissionSource: 'agent'`,
65
+ * which then follows the Agent's own permissions exactly as a Task does while
66
+ * the contract keeps its non-permission roles (normalized shape, ephemeral
67
+ * worktree, result validation, `GIT_OPTIONAL_LOCKS`, provider restriction).
68
+ */
69
+ export function contractGovernsPermissions(contract, permissionSource) {
70
+ if (!contract)
71
+ return false;
72
+ return !(contract.kind === 'commitment' && normalizeSessionPermissionSource(permissionSource) === 'agent');
73
+ }
74
+ /**
75
+ * The contract when it governs permissions, else `undefined` — for the sites
76
+ * that used `executionContract` as "is this run permission-fenced".
77
+ */
78
+ export function permissionGoverningContract(contract, permissionSource) {
79
+ return contract && contractGovernsPermissions(contract, permissionSource) ? contract : undefined;
80
+ }
@@ -62,6 +62,11 @@ export interface TokenPair {
62
62
  * - TOKEN_* — access-token specific (server pushes 4402 close;
63
63
  * daemon classifies as TOKEN_INVALID/TOKEN_EXPIRED).
64
64
  * - SESSION_REVOKED — admin/forensic revoke; whole family burned.
65
+ * - DEVICE_KEY_MISMATCH — the refresh carried a device proof signed by a key
66
+ * other than the one enrolled on this daemon's row
67
+ * (server code `DEVICE_PROOF_THUMBPRINT_MISMATCH`).
68
+ * The daemon signs every retry with the same key, so
69
+ * retrying can never succeed.
65
70
  * - UNKNOWN_401 — server returned 401 with a code we don't
66
71
  * recognize. Treated as permanent (better to prompt
67
72
  * re-auth than to loop forever) but tagged
@@ -74,7 +79,7 @@ export interface TokenPair {
74
79
  * Without this, the client `describeAuthFailure` exhaustiveness check
75
80
  * was silently broken for the non-REFRESH branches.
76
81
  */
77
- export type PermanentAuthReason = 'REFRESH_INVALID' | 'REFRESH_REUSED' | 'REFRESH_EXPIRED' | 'SESSION_REVOKED' | 'TOKEN_INVALID' | 'TOKEN_EXPIRED' | 'UNKNOWN_401';
82
+ export type PermanentAuthReason = 'REFRESH_INVALID' | 'REFRESH_REUSED' | 'REFRESH_EXPIRED' | 'SESSION_REVOKED' | 'DEVICE_KEY_MISMATCH' | 'TOKEN_INVALID' | 'TOKEN_EXPIRED' | 'UNKNOWN_401';
78
83
  export declare class PermanentAuthFailure extends Error {
79
84
  readonly code: PermanentAuthReason;
80
85
  constructor(code: PermanentAuthReason, message: string);
@@ -43,6 +43,46 @@
43
43
  "types": "./dist/cjs/harnessSkillLayout.d.ts",
44
44
  "default": "./dist/cjs/harnessSkillLayout.js"
45
45
  }
46
+ },
47
+ "./daemon-tool-approval": {
48
+ "import": {
49
+ "types": "./dist/esm/daemonToolApproval.d.ts",
50
+ "default": "./dist/esm/daemonToolApproval.js"
51
+ },
52
+ "require": {
53
+ "types": "./dist/cjs/daemonToolApproval.d.ts",
54
+ "default": "./dist/cjs/daemonToolApproval.js"
55
+ }
56
+ },
57
+ "./session-permission-authority": {
58
+ "import": {
59
+ "types": "./dist/esm/sessionPermissionAuthority.d.ts",
60
+ "default": "./dist/esm/sessionPermissionAuthority.js"
61
+ },
62
+ "require": {
63
+ "types": "./dist/cjs/sessionPermissionAuthority.d.ts",
64
+ "default": "./dist/cjs/sessionPermissionAuthority.js"
65
+ }
66
+ },
67
+ "./credential-session": {
68
+ "import": {
69
+ "types": "./dist/esm/credentialSession.d.ts",
70
+ "default": "./dist/esm/credentialSession.js"
71
+ },
72
+ "require": {
73
+ "types": "./dist/cjs/credentialSession.d.ts",
74
+ "default": "./dist/cjs/credentialSession.js"
75
+ }
76
+ },
77
+ "./cli-handoff-wire": {
78
+ "import": {
79
+ "types": "./dist/esm/cliHandoffWire.d.ts",
80
+ "default": "./dist/esm/cliHandoffWire.js"
81
+ },
82
+ "require": {
83
+ "types": "./dist/cjs/cliHandoffWire.d.ts",
84
+ "default": "./dist/cjs/cliHandoffWire.js"
85
+ }
46
86
  }
47
87
  },
48
88
  "dependencies": {