@camerontaylor/paseo-cli 0.11.1-fork.1 → 0.11.2-fork.1

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.
@@ -0,0 +1,21 @@
1
+ import type { Command } from "commander";
2
+ import type { CommandOptions, SingleResult } from "../../output/index.js";
3
+ interface AgentArtifactsScanResult {
4
+ agentId: string;
5
+ addedOrUpdated: number;
6
+ total: number;
7
+ }
8
+ export interface ArtifactsScanOptions extends CommandOptions {
9
+ limit?: string;
10
+ }
11
+ export declare function addArtifactsScanOptions(command: Command): Command;
12
+ /**
13
+ * Backfills an agent's artifact feed from files already on disk.
14
+ *
15
+ * Artifacts are normally collected per turn, so an agent that did its work
16
+ * before the feature existed shows an empty feed no matter how much it
17
+ * produced. This scans its working directory once and records what it finds.
18
+ */
19
+ export declare function runArtifactsScanCommand(agentIdArg: string, options: ArtifactsScanOptions, _command: Command): Promise<SingleResult<AgentArtifactsScanResult>>;
20
+ export {};
21
+ //# sourceMappingURL=artifacts-scan.d.ts.map
@@ -0,0 +1,66 @@
1
+ import { connectToDaemon, getDaemonHost, resolveAgentId } from "../../utils/client.js";
2
+ import { selectDaemonTarget } from "../../utils/daemon-target.js";
3
+ const artifactsScanSchema = {
4
+ idField: "agentId",
5
+ columns: [
6
+ { header: "AGENT ID", field: "agentId" },
7
+ { header: "ADDED/UPDATED", field: "addedOrUpdated" },
8
+ { header: "TOTAL", field: "total" },
9
+ ],
10
+ };
11
+ export function addArtifactsScanOptions(command) {
12
+ return command.option("--limit <count>", "Maximum artifacts to retain, newest first (default: daemon default)");
13
+ }
14
+ /**
15
+ * Backfills an agent's artifact feed from files already on disk.
16
+ *
17
+ * Artifacts are normally collected per turn, so an agent that did its work
18
+ * before the feature existed shows an empty feed no matter how much it
19
+ * produced. This scans its working directory once and records what it finds.
20
+ */
21
+ export async function runArtifactsScanCommand(agentIdArg, options, _command) {
22
+ let limit;
23
+ if (options.limit !== undefined) {
24
+ const parsed = Number.parseInt(options.limit, 10);
25
+ if (!Number.isFinite(parsed) || parsed <= 0) {
26
+ throw {
27
+ code: "INVALID_ARGUMENT",
28
+ message: `--limit must be a positive integer, got: ${options.limit}`,
29
+ };
30
+ }
31
+ limit = parsed;
32
+ }
33
+ const daemonTarget = selectDaemonTarget(options);
34
+ const host = getDaemonHost({ target: daemonTarget });
35
+ let client;
36
+ try {
37
+ client = await connectToDaemon({ target: daemonTarget });
38
+ }
39
+ catch (error) {
40
+ const message = error instanceof Error ? error.message : String(error);
41
+ throw {
42
+ code: "DAEMON_NOT_RUNNING",
43
+ message: `Cannot connect to daemon at ${host}: ${message}`,
44
+ };
45
+ }
46
+ try {
47
+ const payload = await client.fetchAgents({ filter: { includeArchived: true } });
48
+ const agentId = resolveAgentId(agentIdArg, payload.entries.map((entry) => entry.agent));
49
+ if (!agentId) {
50
+ throw {
51
+ code: "AGENT_NOT_FOUND",
52
+ message: `Agent not found: ${agentIdArg}`,
53
+ };
54
+ }
55
+ const result = await client.scanAgentArtifacts(agentId, limit !== undefined ? { limit } : {});
56
+ return {
57
+ type: "single",
58
+ data: { agentId, addedOrUpdated: result.addedOrUpdated, total: result.total },
59
+ schema: artifactsScanSchema,
60
+ };
61
+ }
62
+ finally {
63
+ await client.close().catch(() => undefined);
64
+ }
65
+ }
66
+ //# sourceMappingURL=artifacts-scan.js.map
@@ -11,6 +11,7 @@ import { addInspectOptions, runInspectCommand } from "./inspect.js";
11
11
  import { addWaitOptions, runWaitCommand } from "./wait.js";
12
12
  import { addAttachOptions, runAttachCommand } from "./attach.js";
13
13
  import { addReloadOptions, runReloadCommand } from "./reload.js";
14
+ import { addArtifactsScanOptions, runArtifactsScanCommand } from "./artifacts-scan.js";
14
15
  import { addImportOptions, runImportCommand } from "./import.js";
15
16
  import { runUpdateCommand } from "./update.js";
16
17
  import { runDetachCommand } from "./detach.js";
@@ -40,6 +41,10 @@ export function createAgentCommand() {
40
41
  .option("--list", "List available modes for this agent")).action(withOutput(runModeCommand));
41
42
  addJsonAndDaemonHostOptions(addArchiveOptions(agent.command("archive"))).action(withOutput(runArchiveCommand));
42
43
  addJsonAndDaemonHostOptions(addReloadOptions(agent.command("reload"))).action(withOutput(runReloadCommand));
44
+ addJsonAndDaemonHostOptions(addArtifactsScanOptions(agent
45
+ .command("artifacts-scan")
46
+ .description("Backfill an agent's artifact feed from files already on disk")
47
+ .argument("<id>", "Agent ID, prefix, or name"))).action(withOutput(runArtifactsScanCommand));
43
48
  addJsonAndDaemonHostOptions(agent
44
49
  .command("detach")
45
50
  .description("Make a subagent independent without stopping or moving it")
@@ -1,6 +1,8 @@
1
1
  import { Command } from "commander";
2
+ import { type DaemonClient } from "@camerontaylor/paseo-client/internal/daemon-client";
2
3
  import { connectToDaemon } from "../../utils/client.js";
3
4
  import type { CommandOptions, SingleResult, OutputSchema } from "../../output/index.js";
5
+ import { type ResolvedProviderModel } from "../../utils/provider-model.js";
4
6
  export { resolveProviderAndModel } from "../../utils/provider-model.js";
5
7
  export declare function addRunOptions(cmd: Command): Command;
6
8
  /** Result type for agent run command */
@@ -71,6 +73,11 @@ export interface RunWorkspaceLookupClient {
71
73
  }>;
72
74
  }
73
75
  export declare function resolveExistingRunWorkspace(client: RunWorkspaceLookupClient, workspaceId: string): Promise<RunWorkspace>;
76
+ interface ResolveRunThinkingOptionInput extends ResolvedProviderModel {
77
+ cwd: string;
78
+ thinking: string | undefined;
79
+ }
80
+ export declare function resolveRunThinkingOption(client: Pick<DaemonClient, "listProviderModels">, input: ResolveRunThinkingOptionInput): Promise<string | undefined>;
74
81
  export declare function runRunCommand(prompt: string, options: AgentRunOptions, _command: Command): Promise<SingleResult<AgentRunResult>>;
75
82
  export interface RunCallerLookupClient {
76
83
  fetchAgent(options: {
@@ -412,6 +412,19 @@ async function resolveRunWorkspace(client, options, cwd, callerAgentId) {
412
412
  console.error("Tip: pass --workspace <id> (or set PASEO_WORKSPACE_ID) to run in an existing workspace.");
413
413
  return { id: result.workspace.id, cwd: result.workspace.workspaceDirectory ?? cwd };
414
414
  }
415
+ export async function resolveRunThinkingOption(client, input) {
416
+ if (input.thinking !== undefined)
417
+ return input.thinking;
418
+ const result = await client.listProviderModels(input.provider, { cwd: input.cwd });
419
+ if (result.error) {
420
+ throw { code: "PROVIDER_ERROR", message: result.error };
421
+ }
422
+ const models = result.models ?? [];
423
+ const model = input.model
424
+ ? models.find((candidate) => candidate.id === input.model)
425
+ : (models.find((candidate) => candidate.isDefault) ?? models[0]);
426
+ return (model?.defaultThinkingOptionId ?? model?.thinkingOptions?.find((option) => option.isDefault)?.id);
427
+ }
415
428
  export async function runRunCommand(prompt, options, _command) {
416
429
  const outputSchema = options.outputSchema ? loadOutputSchema(options.outputSchema) : undefined;
417
430
  validateRunOptions(prompt, options, outputSchema);
@@ -422,8 +435,8 @@ export async function runRunCommand(prompt, options, _command) {
422
435
  try {
423
436
  // Resolve working directory
424
437
  const cwd = options.cwd ?? process.cwd();
425
- const thinkingOptionId = options.thinking?.trim();
426
- if (options.thinking !== undefined && !thinkingOptionId) {
438
+ const requestedThinkingOptionId = options.thinking?.trim();
439
+ if (options.thinking !== undefined && !requestedThinkingOptionId) {
427
440
  const error = {
428
441
  code: "INVALID_THINKING_OPTION",
429
442
  message: "--thinking cannot be empty",
@@ -439,6 +452,11 @@ export async function runRunCommand(prompt, options, _command) {
439
452
  const workspace = await resolveRunWorkspace(client, options, cwd, callerAgentId);
440
453
  const workspaceId = workspace.id;
441
454
  const runCwd = workspace.cwd;
455
+ const thinkingOptionId = await resolveRunThinkingOption(client, {
456
+ ...resolvedProviderModel,
457
+ cwd: runCwd,
458
+ thinking: requestedThinkingOptionId,
459
+ });
442
460
  if (outputSchema) {
443
461
  let structuredAgent = null;
444
462
  const callStructuredTurn = async (structuredPrompt) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camerontaylor/paseo-cli",
3
- "version": "0.11.1-fork.1",
3
+ "version": "0.11.2-fork.1",
4
4
  "description": "Paseo CLI - control your AI coding agents from the command line",
5
5
  "bin": {
6
6
  "paseo": "bin/paseo"
@@ -28,9 +28,9 @@
28
28
  },
29
29
  "dependencies": {
30
30
  "@clack/prompts": "^1.0.0",
31
- "@camerontaylor/paseo-client": "0.11.1-fork.1",
32
- "@camerontaylor/paseo-protocol": "0.11.1-fork.1",
33
- "@camerontaylor/paseo-server": "0.11.1-fork.1",
31
+ "@camerontaylor/paseo-client": "0.11.2-fork.1",
32
+ "@camerontaylor/paseo-protocol": "0.11.2-fork.1",
33
+ "@camerontaylor/paseo-server": "0.11.2-fork.1",
34
34
  "chalk": "^5.3.0",
35
35
  "commander": "^12.0.0",
36
36
  "mime-types": "^2.1.35",