@fleetagent/pi-coding-agent 0.0.11 → 0.1.0

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 (72) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/dist/cli/args.d.ts +3 -2
  3. package/dist/cli/args.d.ts.map +1 -1
  4. package/dist/cli/args.js +20 -8
  5. package/dist/cli/args.js.map +1 -1
  6. package/dist/core/agent-session.d.ts +9 -2
  7. package/dist/core/agent-session.d.ts.map +1 -1
  8. package/dist/core/agent-session.js +59 -11
  9. package/dist/core/agent-session.js.map +1 -1
  10. package/dist/core/resource-loader.d.ts.map +1 -1
  11. package/dist/core/resource-loader.js +30 -7
  12. package/dist/core/resource-loader.js.map +1 -1
  13. package/dist/core/rules.d.ts.map +1 -1
  14. package/dist/core/rules.js +20 -15
  15. package/dist/core/rules.js.map +1 -1
  16. package/dist/core/skills.d.ts.map +1 -1
  17. package/dist/core/skills.js +20 -15
  18. package/dist/core/skills.js.map +1 -1
  19. package/dist/core/slash-commands.d.ts.map +1 -1
  20. package/dist/core/slash-commands.js +1 -1
  21. package/dist/core/slash-commands.js.map +1 -1
  22. package/dist/core/source-info.d.ts.map +1 -1
  23. package/dist/core/source-info.js +1 -1
  24. package/dist/core/source-info.js.map +1 -1
  25. package/dist/core/tools/bash.d.ts.map +1 -1
  26. package/dist/core/tools/bash.js +6 -3
  27. package/dist/core/tools/bash.js.map +1 -1
  28. package/dist/core/tools/index.d.ts +1 -1
  29. package/dist/core/tools/index.d.ts.map +1 -1
  30. package/dist/core/tools/index.js +1 -1
  31. package/dist/core/tools/index.js.map +1 -1
  32. package/dist/core/tools/operations.d.ts +49 -4
  33. package/dist/core/tools/operations.d.ts.map +1 -1
  34. package/dist/core/tools/operations.js +340 -4
  35. package/dist/core/tools/operations.js.map +1 -1
  36. package/dist/core/tools/read.d.ts +2 -0
  37. package/dist/core/tools/read.d.ts.map +1 -1
  38. package/dist/core/tools/read.js +12 -5
  39. package/dist/core/tools/read.js.map +1 -1
  40. package/dist/core/tools/render-utils.d.ts.map +1 -1
  41. package/dist/core/tools/render-utils.js +2 -0
  42. package/dist/core/tools/render-utils.js.map +1 -1
  43. package/dist/index.d.ts +1 -1
  44. package/dist/index.d.ts.map +1 -1
  45. package/dist/index.js +1 -1
  46. package/dist/index.js.map +1 -1
  47. package/dist/main.d.ts.map +1 -1
  48. package/dist/main.js +30 -15
  49. package/dist/main.js.map +1 -1
  50. package/dist/modes/interactive/interactive-mode.d.ts +3 -1
  51. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  52. package/dist/modes/interactive/interactive-mode.js +41 -20
  53. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  54. package/dist/modes/rpc/rpc-client.d.ts +11 -4
  55. package/dist/modes/rpc/rpc-client.d.ts.map +1 -1
  56. package/dist/modes/rpc/rpc-client.js +6 -6
  57. package/dist/modes/rpc/rpc-client.js.map +1 -1
  58. package/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
  59. package/dist/modes/rpc/rpc-mode.js +11 -7
  60. package/dist/modes/rpc/rpc-mode.js.map +1 -1
  61. package/dist/modes/rpc/rpc-types.d.ts +10 -4
  62. package/dist/modes/rpc/rpc-types.d.ts.map +1 -1
  63. package/dist/modes/rpc/rpc-types.js.map +1 -1
  64. package/docs/extensions.md +2 -2
  65. package/docs/rpc.md +31 -0
  66. package/docs/usage.md +4 -1
  67. package/examples/extensions/custom-provider-anthropic/package.json +1 -1
  68. package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
  69. package/examples/extensions/sandbox/package.json +1 -1
  70. package/examples/extensions/with-deps/package.json +1 -1
  71. package/npm-shrinkwrap.json +12 -12
  72. package/package.json +4 -4
@@ -1022,7 +1022,7 @@ export class InteractiveMode {
1022
1022
  if (contextFiles.length > 0) {
1023
1023
  this.chatContainer.addChild(new Spacer(1));
1024
1024
  const contextBackendInfo = this.session.getToolBackendInfo?.();
1025
- const contextBackendIcon = contextBackendInfo?.type === "ssh" ? "☁" : "🖥";
1025
+ const contextBackendIcon = contextBackendInfo?.type === "ssh" || contextBackendInfo?.type === "remote" ? "☁" : "🖥";
1026
1026
  const contextList = contextFiles
1027
1027
  .map((f) => theme.fg("dim", ` ${f.path.startsWith(getAgentDir()) ? "🖥" : contextBackendIcon} ${this.formatDisplayPath(f.path)}`))
1028
1028
  .join("\n");
@@ -1036,7 +1036,7 @@ export class InteractiveMode {
1036
1036
  formatPath: (item) => `${getSourceBackendIcon(item.sourceInfo)} ${this.formatDisplayPath(item.path)}`,
1037
1037
  formatPackagePath: (item) => `${getSourceBackendIcon(item.sourceInfo)} ${this.getShortPath(item.path, item.sourceInfo)}`,
1038
1038
  });
1039
- const skillCompactList = formatCompactList(skills.map((skill) => skill.name));
1039
+ const skillCompactList = formatCompactList(skills.map((skill) => `${getSourceBackendIcon(skill.sourceInfo)} ${skill.name}`));
1040
1040
  addLoadedSection("Skills", skillCompactList, skillList);
1041
1041
  }
1042
1042
  const rules = rulesResult.rules;
@@ -1046,7 +1046,7 @@ export class InteractiveMode {
1046
1046
  formatPath: (item) => `${getSourceBackendIcon(item.sourceInfo)} ${this.formatDisplayPath(item.path)}`,
1047
1047
  formatPackagePath: (item) => `${getSourceBackendIcon(item.sourceInfo)} ${this.getShortPath(item.path, item.sourceInfo)}`,
1048
1048
  });
1049
- const ruleCompactList = formatCompactList(rules.map((rule) => rule.name));
1049
+ const ruleCompactList = formatCompactList(rules.map((rule) => `${getSourceBackendIcon(rule.sourceInfo)} ${rule.name}`));
1050
1050
  addLoadedSection("Rules", ruleCompactList, ruleList);
1051
1051
  }
1052
1052
  const templates = this.session.promptTemplates;
@@ -1063,7 +1063,7 @@ export class InteractiveMode {
1063
1063
  return `${getSourceBackendIcon(item.sourceInfo)} ${template ? `/${template.name}` : this.formatDisplayPath(item.path)}`;
1064
1064
  },
1065
1065
  });
1066
- const promptCompactList = formatCompactList(templates.map((template) => `/${template.name}`));
1066
+ const promptCompactList = formatCompactList(templates.map((template) => `${getSourceBackendIcon(template.sourceInfo)} /${template.name}`));
1067
1067
  addLoadedSection("Prompts", promptCompactList, templateList);
1068
1068
  }
1069
1069
  if (extensions.length > 0) {
@@ -1342,10 +1342,12 @@ export class InteractiveMode {
1342
1342
  if (info.type === "local") {
1343
1343
  return theme.fg("dim", `tools: local ${info.cwd}`);
1344
1344
  }
1345
- if (info.configured) {
1346
- return theme.fg("accent", `tools: ssh ${info.remote}:${info.cwd}`);
1345
+ if (info.type === "remote") {
1346
+ return info.configured
1347
+ ? theme.fg("accent", `tools: remote ${info.url} ${info.cwd}`)
1348
+ : theme.fg("warning", `tools: remote not configured ${info.cwd}`);
1347
1349
  }
1348
- return theme.fg("warning", `tools: ssh not configured ${info.cwd}`);
1350
+ return theme.fg("accent", `tools: ssh ${info.remote}:${info.cwd}`);
1349
1351
  }
1350
1352
  updateToolBackendStatus() {
1351
1353
  this.setExtensionStatus("toolBackend", this.formatToolBackendStatus(this.session.getToolBackendInfo()));
@@ -2063,9 +2065,9 @@ export class InteractiveMode {
2063
2065
  this.editor.setText("");
2064
2066
  return;
2065
2067
  }
2066
- if (text === "/ssh-sandbox" || text.startsWith("/ssh-sandbox ")) {
2068
+ if (text === "/remote" || text.startsWith("/remote ")) {
2067
2069
  this.editor.setText("");
2068
- await this.handleSshSandboxCommand(text);
2070
+ await this.handleRemoteCommand(text);
2069
2071
  return;
2070
2072
  }
2071
2073
  if (text === "/changelog") {
@@ -4395,40 +4397,59 @@ export class InteractiveMode {
4395
4397
  this.chatContainer.addChild(new Text(theme.fg("dim", `Session name set: ${name}`), 1, 0));
4396
4398
  this.ui.requestRender();
4397
4399
  }
4398
- async handleSshSandboxCommand(text) {
4399
- const args = text.replace(/^\/ssh-sandbox\s*/, "").trim();
4400
+ async reloadResourcesAfterBackendChange() {
4401
+ await this.session.reload();
4402
+ this.setupAutocompleteProvider();
4403
+ this.showLoadedResources({ force: true, showDiagnosticsWhenQuiet: true });
4404
+ }
4405
+ async handleRemoteCommand(text) {
4406
+ const args = text.replace(/^\/remote\s*/, "").trim();
4400
4407
  if (!args || args === "status") {
4401
4408
  this.showStatus(this.formatToolBackendStatus(this.session.getToolBackendInfo()));
4402
4409
  return;
4403
4410
  }
4404
4411
  if (args === "clear") {
4405
4412
  try {
4406
- this.session.clearSshSandbox();
4413
+ this.session.clearRemoteSandbox();
4414
+ await this.reloadResourcesAfterBackendChange();
4407
4415
  this.updateToolBackendStatus();
4408
- this.showStatus("SSH sandbox cleared");
4416
+ this.showStatus("Remote backend cleared");
4409
4417
  }
4410
4418
  catch (error) {
4411
4419
  this.showError(error instanceof Error ? error.message : String(error));
4412
4420
  }
4413
4421
  return;
4414
4422
  }
4415
- const [targetArg, cwdArg] = args.split(/\s+/, 2);
4423
+ const [kind, targetArg, cwdArg] = args.split(/\s+/, 3);
4424
+ if (kind !== "ssh" && kind !== "daemon") {
4425
+ this.showWarning("Usage: /remote <ssh|daemon> <url> [path]");
4426
+ return;
4427
+ }
4416
4428
  if (!targetArg) {
4417
- this.showWarning("Usage: /ssh-sandbox <user@host[:/path]> [path]");
4429
+ this.showWarning(kind === "ssh" ? "Usage: /remote ssh <user@host[:/path]> [path]" : "Usage: /remote daemon <ws://url>");
4418
4430
  return;
4419
4431
  }
4420
- const separatorIndex = targetArg.indexOf(":");
4421
- const remote = separatorIndex === -1 ? targetArg : targetArg.slice(0, separatorIndex);
4422
- const cwd = cwdArg ?? (separatorIndex === -1 ? undefined : targetArg.slice(separatorIndex + 1));
4423
4432
  try {
4424
- const info = await this.session.configureSshSandbox({ remote, cwd });
4433
+ const info = kind === "ssh"
4434
+ ? await this.session.configureRemoteSandbox({
4435
+ type: "ssh",
4436
+ ...this.parseSshRemoteTarget(targetArg, cwdArg),
4437
+ })
4438
+ : await this.session.configureRemoteSandbox({ type: "daemon", url: targetArg });
4439
+ await this.reloadResourcesAfterBackendChange();
4425
4440
  this.updateToolBackendStatus();
4426
4441
  this.showStatus(this.formatToolBackendStatus(info));
4427
4442
  }
4428
4443
  catch (error) {
4429
- this.showError(`Failed to configure SSH sandbox: ${error instanceof Error ? error.message : String(error)}`);
4444
+ this.showError(`Failed to configure remote backend: ${error instanceof Error ? error.message : String(error)}`);
4430
4445
  }
4431
4446
  }
4447
+ parseSshRemoteTarget(targetArg, cwdArg) {
4448
+ const separatorIndex = targetArg.indexOf(":");
4449
+ const remote = separatorIndex === -1 ? targetArg : targetArg.slice(0, separatorIndex);
4450
+ const cwd = cwdArg ?? (separatorIndex === -1 ? undefined : targetArg.slice(separatorIndex + 1));
4451
+ return { remote, cwd };
4452
+ }
4432
4453
  handleSessionCommand() {
4433
4454
  const stats = this.session.getSessionStats();
4434
4455
  const sessionName = this.activeSession.getSessionName();