@skrr-ai/cli 0.1.65 → 0.1.66

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.
@@ -10,6 +10,14 @@ export declare function parseCapabilityRationales(entries: readonly string[] | u
10
10
  rationales?: Record<string, string>;
11
11
  error?: string;
12
12
  };
13
+ export declare function parseReleaseDependencies(entries: readonly string[] | undefined): {
14
+ dependencies?: Array<{
15
+ entityType: 'skill' | 'action';
16
+ entityId: string;
17
+ artifactVersionId: string;
18
+ }>;
19
+ error?: string;
20
+ };
13
21
  export default class AgentsVisibility extends BaseCommand {
14
22
  static description: string;
15
23
  static examples: string[];
@@ -27,6 +35,7 @@ export default class AgentsVisibility extends BaseCommand {
27
35
  'version-minor': import("@oclif/core/lib/interfaces").OptionFlag<number | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
28
36
  'capability-rationale': import("@oclif/core/lib/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
29
37
  language: import("@oclif/core/lib/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
38
+ dependency: import("@oclif/core/lib/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
30
39
  };
31
40
  run(): Promise<void>;
32
41
  }
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.parseCapabilityRationales = parseCapabilityRationales;
4
+ exports.parseReleaseDependencies = parseReleaseDependencies;
4
5
  const core_1 = require("@oclif/core");
5
6
  const data_provider_1 = require("@skrr-ai/data-provider");
6
7
  const base_command_1 = require("../../base-command");
@@ -28,6 +29,23 @@ function parseCapabilityRationales(entries) {
28
29
  }
29
30
  return { rationales };
30
31
  }
32
+ function parseReleaseDependencies(entries) {
33
+ if (!entries?.length)
34
+ return {};
35
+ const dependencies = [];
36
+ for (const entry of entries) {
37
+ const match = /^(skill|action):([^@]+)@(store_release_[A-Za-z0-9_-]+)$/.exec(entry);
38
+ if (!match) {
39
+ return { error: `--dependency expects skill:<id>@<store-release-id> or action:<id>@<store-release-id>, got "${entry}".` };
40
+ }
41
+ dependencies.push({
42
+ entityType: match[1],
43
+ entityId: match[2],
44
+ artifactVersionId: match[3],
45
+ });
46
+ }
47
+ return { dependencies };
48
+ }
31
49
  class AgentsVisibility extends base_command_1.BaseCommand {
32
50
  static description = 'Set the visibility of an agent (accounts with 2FA need recent step-up for public publishing)';
33
51
  static examples = [
@@ -37,6 +55,7 @@ class AgentsVisibility extends base_command_1.BaseCommand {
37
55
  '<%= config.bin %> agents visibility <agent-id> --public --json',
38
56
  '<%= config.bin %> agents visibility <agent-id> --public --capability-rationale "network:*=Looks up flight prices on the web"',
39
57
  '<%= config.bin %> agents visibility <agent-id> --public --language en --language zh-Hans',
58
+ '<%= config.bin %> agents visibility <agent-id> --public --dependency skill:<skill-id>@<store-release-id>',
40
59
  ];
41
60
  static args = {
42
61
  id: core_1.Args.string({ description: 'Agent ID', required: true, ignoreStdin: true }),
@@ -72,6 +91,10 @@ class AgentsVisibility extends base_command_1.BaseCommand {
72
91
  description: 'A language the release works in, as a BCP 47 tag such as en or zh-Hans (repeatable). Shown on the listing as declared by you; the platform does not check it.',
73
92
  multiple: true,
74
93
  }),
94
+ dependency: core_1.Flags.string({
95
+ description: 'Pin an attached Skill or Action to its immutable Store release: skill:<id>@<store-release-id> (repeatable)',
96
+ multiple: true,
97
+ }),
75
98
  };
76
99
  async run() {
77
100
  this.requireAuth();
@@ -84,6 +107,12 @@ class AgentsVisibility extends base_command_1.BaseCommand {
84
107
  if (rationaleError) {
85
108
  this.error(rationaleError, { exit: 1 });
86
109
  }
110
+ const { dependencies, error: dependencyError } = parseReleaseDependencies(flags.dependency);
111
+ if (dependencyError)
112
+ this.error(dependencyError, { exit: 1 });
113
+ if (dependencies && !isPublic) {
114
+ this.error('--dependency declares pins on a public release; pass it with --public.', { exit: 1 });
115
+ }
87
116
  if (capabilityRationales && !isPublic) {
88
117
  this.error('--capability-rationale applies only when publishing with --public.', {
89
118
  exit: 1,
@@ -131,6 +160,7 @@ class AgentsVisibility extends base_command_1.BaseCommand {
131
160
  versionMinor: flags['version-minor'],
132
161
  capabilityRationales,
133
162
  supportedLanguages: flags.language,
163
+ dependencies,
134
164
  });
135
165
  }
136
166
  catch (err) {
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const core_1 = require("@oclif/core");
4
- const data_schemas_1 = require("@skrr-ai/data-schemas");
5
4
  const scoped_memory_command_1 = require("../../../lib/scoped-memory-command");
6
5
  class MemoryMountsResolve extends scoped_memory_command_1.ScopedMemoryCommand {
7
6
  static description = 'Resolve the ACL-aware Memory mounts for an Agent session';
@@ -14,7 +13,7 @@ class MemoryMountsResolve extends scoped_memory_command_1.ScopedMemoryCommand {
14
13
  this.requireAuth();
15
14
  const { flags } = await this.parse(MemoryMountsResolve);
16
15
  const response = await this.memoryApi(flags.agent, `/mounts${this.query(flags)}`);
17
- const result = { mounts: response.mounts.map((mount) => data_schemas_1.MemoryMountSchema.parse(mount)) };
16
+ const result = { mounts: response.mounts.map(scoped_memory_command_1.parseMemoryMount) };
18
17
  if (flags.json)
19
18
  return this.log(JSON.stringify(result, null, 2));
20
19
  for (const mount of result.mounts) {
@@ -1,4 +1,5 @@
1
1
  import { BaseCommand } from '../../base-command';
2
+ /** Compatibility entry point for a write API removed by canonical Memory Stores. */
2
3
  export default class MemorySave extends BaseCommand {
3
4
  static description: string;
4
5
  static examples: string[];
@@ -1,72 +1,33 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const core_1 = require("@oclif/core");
4
- const data_provider_1 = require("@skrr-ai/data-provider");
5
4
  const base_command_1 = require("../../base-command");
6
- const prompt_1 = require("../../lib/prompt");
7
5
  const memory_scope_1 = require("../../lib/memory-scope");
8
- const memory_workspace_guidance_1 = require("../../lib/memory-workspace-guidance");
6
+ /** Compatibility entry point for a write API removed by canonical Memory Stores. */
9
7
  class MemorySave extends base_command_1.BaseCommand {
10
- static description = 'Create a flat key/value memory in a pool (owner, an agent, user, or workspace)';
8
+ static description = 'Retired flat memory write; use memory maintain remember or memory topics create';
11
9
  static examples = [
12
- '<%= config.bin %> memory save --key "user-preference" --value "dark mode"',
13
- '<%= config.bin %> memory save --from-json memory.json',
14
- '<%= config.bin %> memory save --key "note" --value "remember this" --json',
15
- '<%= config.bin %> memory save --key "team-norm" --value "ship on fridays" --tier workspace --pool-workspace ws_123',
16
- '<%= config.bin %> memory maintain remember \'{"path":"/notes","claim":"remember this"}\' --agent agent_abc123',
10
+ '<%= config.bin %> memory maintain remember \'{"path":"/notes","claim":"Remember this."}\' --agent agent_abc123',
11
+ '<%= config.bin %> memory topics create --help',
17
12
  ];
18
13
  static flags = {
19
- json: core_1.Flags.boolean({ description: 'Output the created memory as JSON' }),
20
- 'from-json': core_1.Flags.string({
21
- description: 'Path to a JSON file (or "-" for stdin) to use as the request body',
22
- }),
23
- key: core_1.Flags.string({ description: 'Memory key (required unless set via --from-json)' }),
24
- value: core_1.Flags.string({ description: 'Memory value (required unless set via --from-json)' }),
14
+ json: core_1.Flags.boolean({ description: 'Output errors as JSON' }),
15
+ 'from-json': core_1.Flags.string({ description: 'Retired flat memory input' }),
16
+ key: core_1.Flags.string({ description: 'Retired flat memory key' }),
17
+ value: core_1.Flags.string({ description: 'Retired flat memory value' }),
25
18
  ...memory_scope_1.memoryScopeFlags,
26
19
  };
27
20
  async run() {
28
- this.requireAuth();
29
21
  const { flags } = await this.parse(MemorySave);
30
- const scope = (0, memory_scope_1.resolveMemoryScopeOrFail)(flags, (m) => this.error(m, { exit: 1 }));
31
- let body = {};
32
- try {
33
- body = await (0, prompt_1.readJsonBody)(flags['from-json']);
34
- }
35
- catch (err) {
36
- this.error(err.message, { exit: 1 });
37
- }
38
- const payload = (0, prompt_1.mergeDefined)(body, {
39
- key: flags.key,
40
- value: flags.value,
22
+ const next = flags.agent
23
+ ? `skrr memory maintain remember '{"path":"/notes","claim":"your memory"}' --agent ${flags.agent}`
24
+ : 'skrr memory topics create --help (choose an Agent or Space Store)';
25
+ this.failWithCliError({
26
+ code: 'LEGACY_MEMORY_WRITE_REMOVED',
27
+ message: `Flat memory writes have been retired. Use canonical Memory Stores. Run: ${next}`,
28
+ exit: 5,
29
+ retryable: false,
41
30
  });
42
- if (!payload.key || typeof payload.key !== 'string') {
43
- this.error('A key is required. Pass --key "..." or include it in --from-json.', { exit: 1 });
44
- }
45
- if (!payload.value || typeof payload.value !== 'string') {
46
- this.error('A value is required. Pass --value "..." or include it in --from-json.', {
47
- exit: 1,
48
- });
49
- }
50
- let result;
51
- try {
52
- result = await data_provider_1.dataService.createMemory({
53
- key: payload.key,
54
- value: payload.value,
55
- }, scope);
56
- }
57
- catch (err) {
58
- this.handleApiError(err);
59
- }
60
- const guidance = scope.agentId ? (0, memory_workspace_guidance_1.semanticWorkspaceGuidance)(scope.agentId) : undefined;
61
- if (flags.json) {
62
- this.log(JSON.stringify(guidance ? { ...result, semanticWorkspace: guidance } : result, null, 2));
63
- return;
64
- }
65
- this.log(`Saved memory ${result.memory.key}`);
66
- if (guidance) {
67
- this.log(`\n${guidance.message}`);
68
- this.log(`To include a fact in that context, run:\n${guidance.nextCommand}`);
69
- }
70
31
  }
71
32
  }
72
33
  exports.default = MemorySave;
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const core_1 = require("@oclif/core");
4
- const data_schemas_1 = require("@skrr-ai/data-schemas");
5
4
  const scoped_memory_command_1 = require("../../../lib/scoped-memory-command");
6
5
  class MemoryStoresList extends scoped_memory_command_1.ScopedMemoryCommand {
7
6
  static description = 'List Memory Stores mounted for an Agent session';
@@ -15,7 +14,7 @@ class MemoryStoresList extends scoped_memory_command_1.ScopedMemoryCommand {
15
14
  const { flags } = await this.parse(MemoryStoresList);
16
15
  const response = await this.memoryApi(flags.agent, `/stores${this.query(flags)}`);
17
16
  const result = {
18
- stores: response.stores.map((store) => data_schemas_1.MountedMemoryStoreSchema.parse(store)),
17
+ stores: response.stores.map(scoped_memory_command_1.parseMountedMemoryStore),
19
18
  };
20
19
  if (flags.json)
21
20
  return this.log(JSON.stringify(result, null, 2));
@@ -51,7 +51,7 @@ class StoreUpdate extends base_command_1.BaseCommand {
51
51
  if (!status?.purchased) {
52
52
  this.error(`${args.agentId} is not installed from the Store. Install it first: skrr store install ${args.agentId}`, { exit: 1 });
53
53
  }
54
- if (status.pendingUpdate && !flags.decline) {
54
+ if (status.pendingUpdate && !flags.decline && !flags.json) {
55
55
  this.log(`A ${status.pendingUpdate.versionLabel ?? 'new'} release is waiting for review ` +
56
56
  `(${status.pendingUpdate.reason}).`);
57
57
  }
@@ -71,6 +71,10 @@ class StoreUpdate extends base_command_1.BaseCommand {
71
71
  // hands back the body as TEXT, so reading `err.body` as an object never
72
72
  // saw a code at all and both answers below fell through to a bare error.
73
73
  const body = (0, http_error_1.httpBodyOf)(err);
74
+ // The shared error renderer keeps the server's typed refusal in one JSON
75
+ // envelope. Human guidance below would corrupt stdout in --json mode.
76
+ if (flags.json)
77
+ this.handleApiError(err);
74
78
  // Not an update: a new major is a separate purchase. Say which version
75
79
  // keeps its free updates, and offer no command — none sells a second
76
80
  // major of a listing yet, and `store install` refuses one you own.
@@ -9,7 +9,7 @@ import { BaseCommand } from '../../base-command';
9
9
  *
10
10
  * Three states, kept apart because they ask for three different things:
11
11
  *
12
- * ready a same-major release that will apply cleanly
12
+ * ready a same-major release is available; eligibility is checked on apply
13
13
  * review one that could not be applied on its own — you and the publisher
14
14
  * both changed the same field, the release widened capabilities, or
15
15
  * the version your copy came from is unknown
@@ -14,7 +14,7 @@ const format_1 = require("../../lib/format");
14
14
  *
15
15
  * Three states, kept apart because they ask for three different things:
16
16
  *
17
- * ready a same-major release that will apply cleanly
17
+ * ready a same-major release is available; eligibility is checked on apply
18
18
  * review one that could not be applied on its own — you and the publisher
19
19
  * both changed the same field, the release widened capabilities, or
20
20
  * the version your copy came from is unknown
@@ -82,7 +82,7 @@ class StoreUpdates extends base_command_1.BaseCommand {
82
82
  channel: install.updatePolicy ?? 'manual',
83
83
  have,
84
84
  waiting: update.versionLabel ?? '-',
85
- detail: 'available; changes and capabilities are checked when you update',
85
+ detail: 'available; checked on apply',
86
86
  });
87
87
  }
88
88
  if (install.stopReason) {
@@ -122,7 +122,7 @@ class StoreUpdates extends base_command_1.BaseCommand {
122
122
  { key: 'detail', header: 'WHY', maxWidth: 46 },
123
123
  ], (line) => this.log(line));
124
124
  this.log('');
125
- this.log('ready → skrr store update <agent>');
125
+ this.log('ready → available; checks run on apply: skrr store update <agent>');
126
126
  this.log('review → skrr store update <agent> --strategy replace (takes the publisher version)');
127
127
  this.log('widened → skrr store update <agent> --accept-capabilities (or --decline to keep yours)');
128
128
  // No command: `store install` refuses a listing you already own, and
@@ -1,10 +1,12 @@
1
- import { type MemoryMount as SharedMemoryMount, type MemoryStore as SharedMemoryStore } from '@skrr-ai/data-schemas';
1
+ import type { MemoryMount as SharedMemoryMount, MemoryStore as SharedMemoryStore } from '@skrr-ai/data-schemas';
2
2
  import { BaseCommand } from '../base-command';
3
3
  import { ApiFetchError, type ApiFetchOptions } from './api-fetch';
4
4
  export type MemoryMount = SharedMemoryMount;
5
5
  export type MemoryStore = SharedMemoryStore & {
6
- mount?: SharedMemoryMount;
6
+ mount: SharedMemoryMount;
7
7
  };
8
+ export declare function parseMemoryMount(value: unknown): MemoryMount;
9
+ export declare function parseMountedMemoryStore(value: unknown): MemoryStore;
8
10
  export declare const scopedMemoryFlags: {
9
11
  agent: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
10
12
  space: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
@@ -1,12 +1,36 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ScopedMemoryCommand = exports.versionedMutationFlags = exports.mutationFlags = exports.scopedMemoryFlags = void 0;
4
+ exports.parseMemoryMount = parseMemoryMount;
5
+ exports.parseMountedMemoryStore = parseMountedMemoryStore;
4
6
  exports.parseMemoryApiError = parseMemoryApiError;
5
7
  const core_1 = require("@oclif/core");
6
- const data_schemas_1 = require("@skrr-ai/data-schemas");
7
8
  const node_crypto_1 = require("node:crypto");
8
9
  const base_command_1 = require("../base-command");
9
10
  const api_fetch_1 = require("./api-fetch");
11
+ // The public CLI must not load the private data-schemas package at runtime.
12
+ // The API validates the full wire contract; check the fields used by CLI commands
13
+ // before treating a response as a mounted Store or mount.
14
+ function parseMemoryMount(value) {
15
+ const mount = value;
16
+ if (!mount || typeof mount !== 'object' || typeof mount.storeId !== 'string' ||
17
+ typeof mount.uri !== 'string' || typeof mount.authorizationGeneration !== 'number' ||
18
+ !['read_only', 'read_write'].includes(String(mount.access)) ||
19
+ !['agent', 'current_space', 'ancestor_space'].includes(String(mount.source))) {
20
+ throw new Error('Invalid Memory mount response from server');
21
+ }
22
+ return mount;
23
+ }
24
+ function parseMountedMemoryStore(value) {
25
+ const store = value;
26
+ if (!store || typeof store !== 'object' || typeof store.id !== 'string' ||
27
+ typeof store.revision !== 'number' || typeof store.authorizationGeneration !== 'number' ||
28
+ !store.owner || !['agent', 'space'].includes(String(store.owner.kind)) ||
29
+ typeof store.owner.id !== 'string') {
30
+ throw new Error('Invalid Memory Store response from server');
31
+ }
32
+ return { ...store, mount: parseMemoryMount(store.mount) };
33
+ }
10
34
  exports.scopedMemoryFlags = {
11
35
  agent: core_1.Flags.string({ description: 'Act through this Agent', required: true }),
12
36
  space: core_1.Flags.string({ description: 'Current Space context (required for Space scopes)' }),
@@ -126,7 +150,7 @@ class ScopedMemoryCommand extends base_command_1.BaseCommand {
126
150
  async resolveStore(flags, { write = false } = {}) {
127
151
  if (flags.store) {
128
152
  const rawStore = await this.memoryApi(flags.agent, `/stores/${encodeURIComponent(flags.store)}${this.query(flags)}`);
129
- const store = data_schemas_1.MountedMemoryStoreSchema.parse(rawStore);
153
+ const store = parseMountedMemoryStore(rawStore);
130
154
  if (write && store.mount?.access !== 'read_write') {
131
155
  this.error('MEMORY_STORE_READ_ONLY: selected Store is read-only', { exit: 5 });
132
156
  }
@@ -143,7 +167,7 @@ class ScopedMemoryCommand extends base_command_1.BaseCommand {
143
167
  this.error(`MEMORY_SPACE_CONTEXT_REQUIRED: --space ${id} is required when selecting ${flags.scope}.`, { exit: 2, code: 'MEMORY_SPACE_CONTEXT_REQUIRED' });
144
168
  }
145
169
  const response = await this.memoryApi(flags.agent, `/stores${this.query(flags)}`);
146
- const stores = response.stores.map((store) => data_schemas_1.MountedMemoryStoreSchema.parse(store));
170
+ const stores = response.stores.map(parseMountedMemoryStore);
147
171
  const store = stores.find((candidate) => candidate.owner.kind === kind && candidate.owner.id === id);
148
172
  if (!store)
149
173
  this.error(`MEMORY_NOT_MOUNTED: ${flags.scope}`, { exit: 5 });
@@ -46542,10 +46542,10 @@ var gR = Object.freeze({ __proto__: null, acceptAgentIntuition: function(e2, t2,
46542
46542
  }, setAgentUsageCap: function(e2, t2) {
46543
46543
  return oR.put(Nn(e2), t2);
46544
46544
  }, setAgentVisibility: function(e2) {
46545
- var t2 = e2.agentId, n2 = e2.isPublic, o2 = e2.price, r2 = e2.shareMode, a2 = e2.changelog, i2 = e2.versionMajor, s2 = e2.versionMinor, c2 = e2.capabilityRationales, l2 = e2.supportedLanguages, u2 = e2.license, d2 = e2.sourceVisibility, p2 = { isPublic: n2 };
46546
- return void 0 !== o2 && (p2.price = o2), void 0 !== r2 && (p2.shareMode = r2), void 0 !== a2 && (p2.changelog = a2), void 0 !== i2 && (p2.versionMajor = i2), void 0 !== s2 && (p2.versionMinor = s2), void 0 !== c2 && (p2.capabilityRationales = c2), void 0 !== l2 && (p2.supportedLanguages = l2), void 0 !== u2 && (p2.license = u2), void 0 !== d2 && (p2.sourceVisibility = d2), oR.post((function(e3) {
46545
+ var t2 = e2.agentId, n2 = e2.isPublic, o2 = e2.price, r2 = e2.shareMode, a2 = e2.changelog, i2 = e2.versionMajor, s2 = e2.versionMinor, c2 = e2.capabilityRationales, l2 = e2.supportedLanguages, u2 = e2.dependencies, d2 = e2.license, p2 = e2.sourceVisibility, m2 = { isPublic: n2 };
46546
+ return void 0 !== o2 && (m2.price = o2), void 0 !== r2 && (m2.shareMode = r2), void 0 !== a2 && (m2.changelog = a2), void 0 !== i2 && (m2.versionMajor = i2), void 0 !== s2 && (m2.versionMinor = s2), void 0 !== c2 && (m2.capabilityRationales = c2), void 0 !== l2 && (m2.supportedLanguages = l2), void 0 !== u2 && (m2.dependencies = u2), void 0 !== d2 && (m2.license = d2), void 0 !== p2 && (m2.sourceVisibility = p2), oR.post((function(e3) {
46547
46547
  return "".concat(en, "/api/agents/").concat(e3, "/visibility");
46548
- })(t2), p2);
46548
+ })(t2), m2);
46549
46549
  }, setAlwaysOnDesired: function(e2, t2) {
46550
46550
  return oR.put((n2 = e2, "".concat(en, "/api/agents/").concat(encodeURIComponent(n2), "/always-on")), t2);
46551
46551
  var n2;