@skrr-ai/cli 0.1.204 → 0.1.207

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 (55) hide show
  1. package/bin/dev-fallback.js +47 -29
  2. package/bin/dev.cjs +6 -0
  3. package/dist/commands/agent/message/send.d.ts +7 -1
  4. package/dist/commands/agent/message/send.js +13 -0
  5. package/dist/commands/agents/models.d.ts +11 -0
  6. package/dist/commands/agents/models.js +51 -0
  7. package/dist/commands/balance/route-premiums.d.ts +9 -0
  8. package/dist/commands/balance/route-premiums.js +33 -0
  9. package/dist/commands/convos/transcript.d.ts +47 -0
  10. package/dist/commands/convos/transcript.js +460 -0
  11. package/dist/commands/goals/create.d.ts +1 -0
  12. package/dist/commands/goals/create.js +8 -0
  13. package/dist/commands/goals/creation-receipt.d.ts +10 -0
  14. package/dist/commands/goals/creation-receipt.js +43 -0
  15. package/dist/commands/goals/key-results/create.d.ts +2 -0
  16. package/dist/commands/goals/key-results/create.js +14 -0
  17. package/dist/commands/goals/key-results/creation-receipt.d.ts +13 -0
  18. package/dist/commands/goals/key-results/creation-receipt.js +51 -0
  19. package/dist/commands/harnesses/forget.d.ts +2 -0
  20. package/dist/commands/harnesses/forget.js +31 -0
  21. package/dist/commands/harnesses/removal-receipt.d.ts +11 -0
  22. package/dist/commands/harnesses/removal-receipt.js +32 -0
  23. package/dist/commands/harnesses/removal-review.d.ts +11 -0
  24. package/dist/commands/harnesses/removal-review.js +28 -0
  25. package/dist/commands/spaces/loops/release-receipt.d.ts +14 -0
  26. package/dist/commands/spaces/loops/release-receipt.js +48 -0
  27. package/dist/commands/spaces/loops/release.js +1 -1
  28. package/dist/commands/spaces/workflow-templates/archive.d.ts +1 -0
  29. package/dist/commands/spaces/workflow-templates/archive.js +9 -1
  30. package/dist/commands/spaces/workflow-templates/show.js +2 -0
  31. package/dist/commands/spaces/workflow-templates/update.d.ts +1 -0
  32. package/dist/commands/spaces/workflow-templates/update.js +12 -1
  33. package/dist/commands/spaces/workflows/publish.d.ts +1 -0
  34. package/dist/commands/spaces/workflows/publish.js +41 -2
  35. package/dist/commands/tasks/create.d.ts +2 -0
  36. package/dist/commands/tasks/create.js +19 -6
  37. package/dist/commands/tasks/creation-receipt.d.ts +12 -0
  38. package/dist/commands/tasks/creation-receipt.js +53 -0
  39. package/dist/commands/tasks/delete.d.ts +1 -0
  40. package/dist/commands/tasks/delete.js +22 -4
  41. package/dist/commands/tasks/deletion-receipt.d.ts +12 -0
  42. package/dist/commands/tasks/deletion-receipt.js +37 -0
  43. package/dist/lib/execution-target.d.ts +1 -1
  44. package/dist/lib/execution-target.js +4 -0
  45. package/dist/lib/harnesses.d.ts +25 -0
  46. package/dist/lib/harnesses.js +15 -0
  47. package/dist/lib/request-uuid.d.ts +2 -0
  48. package/dist/lib/request-uuid.js +10 -0
  49. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/firstPartyHarness.d.ts +16 -15
  50. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/firstPartyHarness.js +0 -22
  51. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/firstPartyHarness.d.ts +16 -15
  52. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/firstPartyHarness.js +0 -22
  53. package/dist/node_modules/@skrr-ai/data-provider/index.js +11498 -11396
  54. package/oclif.manifest.json +915 -2
  55. package/package.json +6 -3
@@ -118,44 +118,61 @@ function resolveSourceSpecifier(fileSystem, fromDirectory, specifier) {
118
118
  * that starts resolving later changes the digest, which is the correct verdict.
119
119
  */
120
120
  function commandClosureDigest(fileSystem, sourceRoot, entrySource) {
121
- const seen = new Set();
122
- const unresolved = [];
123
- const pending = [path.resolve(entrySource)];
124
- while (pending.length) {
125
- const current = pending.pop();
126
- if (seen.has(current)) continue;
127
- seen.add(current);
128
- let text;
121
+ return createCommandClosureDigest(fileSystem, sourceRoot)(entrySource);
122
+ }
123
+
124
+ // Reuse source reads and import resolution across commands in one manifest.
125
+ // Runtime lookups create a fresh reader for each freshness check.
126
+ function createCommandClosureDigest(fileSystem, sourceRoot) {
127
+ const sources = new Map();
128
+ function readSource(file) {
129
+ if (sources.has(file)) return sources.get(file);
130
+ const source = { bytes: null, dependencies: [], unresolved: [] };
131
+ sources.set(file, source);
129
132
  try {
130
- text = fileSystem.readFileSync(current, 'utf8');
133
+ source.bytes = fileSystem.readFileSync(file);
131
134
  } catch {
132
- continue;
135
+ return source;
133
136
  }
134
- for (const specifier of relativeSpecifiers(text)) {
135
- const resolved = resolveSourceSpecifier(fileSystem, path.dirname(current), specifier);
137
+ for (const specifier of relativeSpecifiers(source.bytes.toString('utf8'))) {
138
+ const resolved = resolveSourceSpecifier(fileSystem, path.dirname(file), specifier);
136
139
  if (resolved) {
137
- if (!seen.has(resolved)) pending.push(resolved);
140
+ source.dependencies.push(resolved);
138
141
  } else {
139
- unresolved.push(`${path.relative(sourceRoot, current)}:${specifier}`);
142
+ source.unresolved.push(`${path.relative(sourceRoot, file)}:${specifier}`);
140
143
  }
141
144
  }
145
+ return source;
142
146
  }
143
- const hash = crypto.createHash('sha256');
144
- for (const file of [...seen].sort()) {
145
- hash.update(path.relative(sourceRoot, file).split(path.sep).join('/'));
146
- hash.update('\0');
147
- try {
148
- hash.update(fileSystem.readFileSync(file));
149
- } catch {
150
- hash.update('<unreadable>');
147
+
148
+ return (entrySource) => {
149
+ const seen = new Set();
150
+ const unresolved = [];
151
+ const pending = [path.resolve(entrySource)];
152
+ while (pending.length) {
153
+ const current = pending.pop();
154
+ if (seen.has(current)) continue;
155
+ seen.add(current);
156
+ const { dependencies, unresolved: misses } = readSource(current);
157
+ unresolved.push(...misses);
158
+ for (const dependency of dependencies) {
159
+ if (!seen.has(dependency)) pending.push(dependency);
160
+ }
151
161
  }
152
- hash.update('\0');
153
- }
154
- for (const miss of unresolved.sort()) {
155
- hash.update(miss.split(path.sep).join('/'));
156
- hash.update('\0');
157
- }
158
- return hash.digest('hex');
162
+
163
+ const hash = crypto.createHash('sha256');
164
+ for (const file of [...seen].sort()) {
165
+ hash.update(path.relative(sourceRoot, file).split(path.sep).join('/'));
166
+ hash.update('\0');
167
+ hash.update(sources.get(file).bytes ?? '<unreadable>');
168
+ hash.update('\0');
169
+ }
170
+ for (const miss of unresolved.sort()) {
171
+ hash.update(miss.split(path.sep).join('/'));
172
+ hash.update('\0');
173
+ }
174
+ return hash.digest('hex');
175
+ };
159
176
  }
160
177
 
161
178
  function findAlternateCli({
@@ -386,6 +403,7 @@ function missingLocalCommandBuild({ cliRoot, argv, fileSystem = fs, verifySource
386
403
  module.exports = {
387
404
  COMMAND_BUILD_MANIFEST,
388
405
  commandClosureDigest,
406
+ createCommandClosureDigest,
389
407
  findAlternateCli,
390
408
  missingLocalCommandBuild,
391
409
  sourceTreeDigest,
package/bin/dev.cjs CHANGED
@@ -1,3 +1,4 @@
1
+ #!/usr/bin/env node
1
2
  'use strict';
2
3
 
3
4
  // Load the same commands, flags and hooks as the shipped CLI, directly from the
@@ -7,6 +8,11 @@ const { Plugin, settings, run } = require('@oclif/core');
7
8
 
8
9
  async function main(argv) {
9
10
  const root = path.resolve(__dirname, '..');
11
+ // Resolve the TypeScript loader from the CLI checkout. A managed session
12
+ // can start in an unrelated project's directory with its own tsconfig.
13
+ process.env.TSX_TSCONFIG_PATH = path.join(root, 'tsconfig.json');
14
+ await import('tsx');
15
+ process.env.OCLIF_SKIP_NEW_VERSION_CHECK = '1';
10
16
  const pjson = require('../package.json');
11
17
  settings.enableAutoTranspile = true;
12
18
  const source = new Plugin({ root, isRoot: true, ignoreManifest: true, errorOnManifestCreate: true });
@@ -1,4 +1,4 @@
1
- import { type EntityEmbed, type MessageOperation } from '@skrr-ai/data-provider';
1
+ import { dataService, type EntityEmbed, type MessageOperation } from '@skrr-ai/data-provider';
2
2
  import { BaseCommand } from '../../../base-command';
3
3
  import { type ResolvedAgentIdentity } from '../../../lib/agent-resolver';
4
4
  import { type CanonicalDestinationKind, type CanonicalMessageDestination, type CanonicalMessageIntentRequest, type CanonicalMessageIntentResponse, type CommunicationPresentation, type MessageOperationOutcome, type OneVoiceOutcome } from '../../../lib/message-intent';
@@ -240,6 +240,12 @@ export declare function normalizeIntentPayload({ agentId, jsonBody, merged, }: {
240
240
  merged: Record<string, unknown>;
241
241
  }): NormalizedIntentPayload;
242
242
  export declare function generateIdempotencyKey(agentId: string, payload: Pick<NormalizedIntentPayload, 'destination' | 'content' | 'presentation' | 'context' | 'threadRootMessageId'>, operation?: MessageOperation): string;
243
+ /**
244
+ * The app message a person's owner-DM send became, as the session path names it (`messageId`),
245
+ * so the text output says `Message id: …` on this path too. Only a send that reached the chat
246
+ * names one.
247
+ */
248
+ export declare function legacyDmMessageId(result: Awaited<ReturnType<typeof dataService.sendAgentDmMessage>>): string | undefined;
243
249
  export declare function buildEnvelope(input: {
244
250
  ok: boolean;
245
251
  principalKind: PrincipalKind;
@@ -43,6 +43,7 @@ exports.sequenceHalt = sequenceHalt;
43
43
  exports.rejectPrincipalOverrides = rejectPrincipalOverrides;
44
44
  exports.normalizeIntentPayload = normalizeIntentPayload;
45
45
  exports.generateIdempotencyKey = generateIdempotencyKey;
46
+ exports.legacyDmMessageId = legacyDmMessageId;
46
47
  exports.buildEnvelope = buildEnvelope;
47
48
  exports.withAppliedAttention = withAppliedAttention;
48
49
  exports.formatEnvelope = formatEnvelope;
@@ -582,6 +583,7 @@ class AgentMessageSend extends base_command_1.BaseCommand {
582
583
  notificationPolicy: request.notificationPolicy,
583
584
  embeds: request.embeds,
584
585
  embedRejections: result.embedRejections,
586
+ messageId: legacyDmMessageId(result),
585
587
  intent: {
586
588
  id: result.messageId ?? null,
587
589
  status: statusFromLegacyDm(result),
@@ -1238,6 +1240,17 @@ function statusFromLegacyDm(result) {
1238
1240
  return 'failed';
1239
1241
  return 'delivered';
1240
1242
  }
1243
+ /**
1244
+ * The app message a person's owner-DM send became, as the session path names it (`messageId`),
1245
+ * so the text output says `Message id: …` on this path too. Only a send that reached the chat
1246
+ * names one.
1247
+ */
1248
+ function legacyDmMessageId(result) {
1249
+ const status = statusFromLegacyDm(result);
1250
+ if (status !== 'delivered' && status !== 'duplicate')
1251
+ return undefined;
1252
+ return typeof result.messageId === 'string' && result.messageId ? result.messageId : undefined;
1253
+ }
1241
1254
  function buildEnvelope(input) {
1242
1255
  const presentation = input.presentation
1243
1256
  ? withAppliedAttention(input.presentation, input.appliedPresentation)
@@ -0,0 +1,11 @@
1
+ import { BaseCommand } from '../../base-command';
2
+ export default class AgentsModels extends BaseCommand {
3
+ static description: string;
4
+ static examples: string[];
5
+ static flags: {
6
+ purpose: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
7
+ placement: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
8
+ json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
9
+ };
10
+ run(): Promise<void>;
11
+ }
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const core_1 = require("@oclif/core");
4
+ const data_provider_1 = require("@skrr-ai/data-provider");
5
+ const base_command_1 = require("../../base-command");
6
+ const placements = ['cloud-worker', 'machine'];
7
+ class AgentsModels extends base_command_1.BaseCommand {
8
+ static description = 'Show managed Agent models, capability admission, and price status';
9
+ static examples = [
10
+ '<%= config.bin %> agents models',
11
+ '<%= config.bin %> agents models --purpose agent.turn --placement machine --json',
12
+ ];
13
+ static flags = {
14
+ purpose: core_1.Flags.string({ description: 'Model purpose', default: 'agent.turn' }),
15
+ placement: core_1.Flags.string({
16
+ description: 'Execution placement',
17
+ options: placements,
18
+ default: 'cloud-worker',
19
+ }),
20
+ json: core_1.Flags.boolean({ description: 'Output the model catalog as JSON' }),
21
+ };
22
+ async run() {
23
+ this.requireAuth();
24
+ const { flags } = await this.parse(AgentsModels);
25
+ let catalog;
26
+ try {
27
+ catalog = await data_provider_1.dataService.getAgentModelOptions(flags.purpose, flags.placement);
28
+ }
29
+ catch (error) {
30
+ this.handleApiError(error, { subject: 'Managed Agent model catalog' });
31
+ }
32
+ if (flags.json)
33
+ return this.printJsonResult(catalog);
34
+ this.log(`Managed Agent models for ${catalog.purpose} (${flags.placement})`);
35
+ this.log(`Price book ${catalog.priceBookVersion ?? 'not reported'}`);
36
+ if (catalog.options.length === 0)
37
+ this.log('No models listed for this purpose and placement.');
38
+ for (const { alias, admitted, availability, decisions, price } of catalog.options) {
39
+ this.log(` ${alias} ${admitted ? 'admitted' : 'refused'}`);
40
+ if (availability?.message)
41
+ this.log(` ${availability.message}`);
42
+ for (const [capability, decision] of Object.entries(decisions)) {
43
+ this.log(` ${capability} ${decision.admitted ? 'admitted' : 'refused'} (${decision.reason})`);
44
+ }
45
+ this.log(price.status === 'priced'
46
+ ? ` priced ${price.currency} ${price.inputPerMTok} input / ${price.outputPerMTok} output per 1M tokens`
47
+ : ` price ${price.status}`);
48
+ }
49
+ }
50
+ }
51
+ exports.default = AgentsModels;
@@ -0,0 +1,9 @@
1
+ import { BaseCommand } from '../../base-command';
2
+ export default class BalanceRoutePremiums extends BaseCommand {
3
+ static description: string;
4
+ static examples: string[];
5
+ static flags: {
6
+ json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
7
+ };
8
+ run(): Promise<void>;
9
+ }
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const core_1 = require("@oclif/core");
4
+ const data_provider_1 = require("@skrr-ai/data-provider");
5
+ const base_command_1 = require("../../base-command");
6
+ class BalanceRoutePremiums extends base_command_1.BaseCommand {
7
+ static description = 'Show model routing premiums currently in effect and when they expire';
8
+ static examples = [
9
+ '<%= config.bin %> balance route-premiums',
10
+ '<%= config.bin %> balance route-premiums --json',
11
+ ];
12
+ static flags = { json: core_1.Flags.boolean({ description: 'Output route premiums as JSON' }) };
13
+ async run() {
14
+ this.requireAuth();
15
+ const { flags } = await this.parse(BalanceRoutePremiums);
16
+ let report;
17
+ try {
18
+ report = await data_provider_1.dataService.getRoutePremiums();
19
+ }
20
+ catch (error) {
21
+ this.handleApiError(error, { subject: 'Current route premiums' });
22
+ }
23
+ if (flags.json)
24
+ return this.printJsonResult(report);
25
+ this.log(`Route premiums as of ${report.asOf}`);
26
+ if (report.premiums.length === 0)
27
+ this.log('No active route premiums.');
28
+ for (const { alias, multiplier, reason, until } of report.premiums) {
29
+ this.log(` ${alias} up to ${multiplier}x list price (${reason}), until ${until}`);
30
+ }
31
+ }
32
+ }
33
+ exports.default = BalanceRoutePremiums;
@@ -0,0 +1,47 @@
1
+ import { type ContextBreakReason, type ConversationTranscriptItem, type ConversationTranscriptTurn, type ConversationTranscriptTurnBody, type LocalSessionContinuationState, type TurnTranscriptSource, type TurnTranscriptUsage } from '@skrr-ai/data-provider';
2
+ import { BaseCommand } from '../../base-command';
3
+ /**
4
+ * What each break reason says on a boundary line. Exhaustive by type: a reason added to
5
+ * `CONTEXT_BREAK_REASONS` does not compile here until it has words.
6
+ */
7
+ export declare const CONTEXT_BREAK_WORDS: Record<ContextBreakReason, string>;
8
+ /** What each transcript source says in a turn header. Exhaustive by type. */
9
+ export declare const TRANSCRIPT_SOURCE_WORDS: Record<TurnTranscriptSource, string>;
10
+ /**
11
+ * Where a continuation sent to an imported session is, as its receipt says. Exhaustive by type.
12
+ */
13
+ export declare const CONTINUATION_STATE_WORDS: Record<LocalSessionContinuationState, string>;
14
+ /** Whether the harness context continued into this turn, in words. Never guesses "continued". */
15
+ export declare function describeContext(turn: ConversationTranscriptTurn): string;
16
+ /** The line drawn above a turn whose harness context did not continue, or null. */
17
+ export declare function boundaryLine(turn: ConversationTranscriptTurn): string | null;
18
+ export declare function usageSummary(usage: TurnTranscriptUsage | undefined): string | null;
19
+ /** The turn's process in one line: where it is kept, how much, and what was lost. */
20
+ export declare function processSummary(turn: ConversationTranscriptTurn): string;
21
+ /** The lines `skrr convos transcript` prints for one item. */
22
+ export declare function formatTranscriptItem(item: ConversationTranscriptItem): string[];
23
+ export declare function formatTurnBody(body: ConversationTranscriptTurnBody): string[];
24
+ /**
25
+ * `skrr convos transcript` — a conversation's whole session, as a conversation (G11, D12).
26
+ *
27
+ * The same items Session Details shows: the person's messages (follow-ups and steers included,
28
+ * and those Main Chat hides), each turn with where its process is kept, and every message the
29
+ * agent sent. A line marks each place the harness context did not continue. `--turn` prints one
30
+ * turn's whole process, paging through it.
31
+ */
32
+ export default class ConvosTranscript extends BaseCommand {
33
+ static description: string;
34
+ static examples: string[];
35
+ static args: {
36
+ id: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
37
+ };
38
+ static flags: {
39
+ json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
40
+ turn: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
41
+ limit: import("@oclif/core/interfaces").OptionFlag<number | undefined, import("@oclif/core/interfaces").CustomOptions>;
42
+ cursor: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
43
+ around: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
44
+ };
45
+ run(): Promise<void>;
46
+ private printTurn;
47
+ }