@conto_finance/create-conto-agent 0.10.0 → 0.10.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.10.1
4
+
5
+ - `--connect` includes the custom server URL in resume commands. Resuming on a different server
6
+ preserves the original approval request.
7
+ - Resuming an expired request clears it and exits 1 with `EXPIRED`. Run `--connect` again for a
8
+ fresh approval link.
9
+ - Pending JSON reports `sandboxPolicyCopyRequested` when sandbox policies were requested for
10
+ copying. `sandboxPoliciesCopied` stays false while approval is pending.
11
+
3
12
  ## 0.10.0
4
13
 
5
14
  - `create-conto-agent --connect` sets an agent up in a person's real Conto account without a
package/README.md CHANGED
@@ -81,6 +81,13 @@ the sandbox's policies. Exit codes: 0 approved or the link is out, 1 failed or e
81
81
  or refused, 4 still waiting. See
82
82
  [connect to a person's account](https://conto.finance/docs/cli/commands#connect-to-a-persons-account).
83
83
 
84
+ If you use a custom server, the printed resume command includes its `--base-url`. A server mismatch
85
+ keeps the pending request available. Use `--restart` to replace it explicitly. Resuming an expired
86
+ request clears it and exits 1. Run `--connect` again to request a fresh approval.
87
+
88
+ In pending JSON, `sandboxPolicyCopyRequested` tells you whether the request includes sandbox
89
+ policies to copy on approval. `sandboxPoliciesCopied` stays false while approval is pending.
90
+
84
91
  ## Hand a sandbox to its owner
85
92
 
86
93
  ```bash
@@ -22,7 +22,7 @@ import {
22
22
  // package.json
23
23
  var package_default = {
24
24
  name: "@conto_finance/create-conto-agent",
25
- version: "0.10.0",
25
+ version: "0.10.1",
26
26
  description: "Set up an AI agent with Conto spending controls",
27
27
  bin: {
28
28
  "create-conto-agent": "bin/create-conto-agent.js",
@@ -3895,8 +3895,16 @@ function printRequest(request, reused) {
3895
3895
  printInfo("Approving also copies this project's sandbox policies to the new agent.");
3896
3896
  }
3897
3897
  }
3898
- function pendingNextSteps() {
3899
- return [`${FULL_CLI2} --connect --wait --json`];
3898
+ function connectCommand(baseUrl) {
3899
+ const command = `${FULL_CLI2} --connect`;
3900
+ if (baseUrl === DEFAULT_BASE_URL2) return command;
3901
+ return `${command} --base-url '${baseUrl.replaceAll("'", "'\\''")}'`;
3902
+ }
3903
+ function expiredRequest(cwd, request) {
3904
+ removeSavedRequest(cwd);
3905
+ throw new ConnectStop(CONNECT_EXIT_CODES.failed, "EXPIRED", "The setup request expired.", {
3906
+ nextStep: `Start a new one: ${connectCommand(request.baseUrl)}${request.emailed ? " --email <their email>" : ""}`
3907
+ });
3900
3908
  }
3901
3909
  async function runConnect(options = {}) {
3902
3910
  try {
@@ -3947,12 +3955,16 @@ async function connect(options) {
3947
3955
  let reused = false;
3948
3956
  const saved = loadSavedRequest(cwd);
3949
3957
  if (saved && !options.restart) {
3950
- if (saved.baseUrl === baseUrl && !isExpired(saved)) {
3951
- request = saved;
3952
- reused = true;
3953
- } else {
3954
- removeSavedRequest(cwd);
3958
+ if (saved.baseUrl !== baseUrl) {
3959
+ throw new ConnectStop(
3960
+ CONNECT_EXIT_CODES.refused,
3961
+ "SERVER_MISMATCH",
3962
+ "This project has a setup request for another server. Repeat the original --base-url to resume it, or use --restart to start over on this server."
3963
+ );
3955
3964
  }
3965
+ if (isExpired(saved)) expiredRequest(cwd, saved);
3966
+ request = saved;
3967
+ reused = true;
3956
3968
  } else if (saved) {
3957
3969
  removeSavedRequest(cwd);
3958
3970
  }
@@ -3995,16 +4007,17 @@ async function connect(options) {
3995
4007
  expiresAt: request.expiresAt,
3996
4008
  emailed: request.emailed,
3997
4009
  ...request.emailFailed ? { emailFailed: true } : {},
3998
- sandboxPoliciesCopied: request.sandboxRules,
4010
+ sandboxPoliciesCopied: false,
4011
+ sandboxPolicyCopyRequested: request.sandboxRules,
3999
4012
  savedIn: SETUP_REQUEST_FILE,
4000
4013
  ...reused ? { reused: true } : {},
4001
4014
  tellThePerson: request.emailed ? `Conto emailed you a link. Check that it shows the code ${request.userCode}, then approve.` : `Open ${request.link}, check that it shows the code ${request.userCode}, then approve.`,
4002
- nextSteps: pendingNextSteps()
4015
+ nextSteps: [`${connectCommand(baseUrl)} --wait --json`]
4003
4016
  });
4004
4017
  } else {
4005
4018
  printRequest(request, reused);
4006
4019
  console.log("");
4007
- console.log(` Then run: ${chalk3.cyan(`${FULL_CLI2} --connect --wait`)}`);
4020
+ console.log(` Then run: ${chalk3.cyan(`${connectCommand(baseUrl)} --wait`)}`);
4008
4021
  console.log("");
4009
4022
  }
4010
4023
  return;
@@ -4035,10 +4048,7 @@ async function connect(options) {
4035
4048
  );
4036
4049
  }
4037
4050
  if (result.status === "expired") {
4038
- removeSavedRequest(cwd);
4039
- throw new ConnectStop(CONNECT_EXIT_CODES.failed, "EXPIRED", "The setup request expired.", {
4040
- nextStep: `Start a new one: ${FULL_CLI2} --connect${request.emailed ? " --email <their email>" : ""}`
4041
- });
4051
+ expiredRequest(cwd, request);
4042
4052
  }
4043
4053
  if (result.status === "delivered") {
4044
4054
  removeSavedRequest(cwd);
@@ -4063,7 +4073,7 @@ async function connect(options) {
4063
4073
  link: request.link,
4064
4074
  userCode: request.userCode,
4065
4075
  expiresAt: request.expiresAt,
4066
- nextStep: `Run it again to keep waiting: ${FULL_CLI2} --connect --wait`
4076
+ nextStep: `Run it again to keep waiting: ${connectCommand(baseUrl)} --wait`
4067
4077
  }
4068
4078
  );
4069
4079
  }
package/dist/cli.js CHANGED
@@ -29,7 +29,7 @@ import {
29
29
  runConnect,
30
30
  runInit,
31
31
  writeProjectStateFile
32
- } from "./chunk-ALQ6UCGI.js";
32
+ } from "./chunk-K5KWPN2D.js";
33
33
  import {
34
34
  BUDGET_PERIODS,
35
35
  VELOCITY_PERIODS,
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  runConnect,
3
3
  runInit
4
- } from "./chunk-ALQ6UCGI.js";
4
+ } from "./chunk-K5KWPN2D.js";
5
5
  import {
6
6
  delegatesToCli
7
7
  } from "./chunk-D6JPJHU4.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@conto_finance/create-conto-agent",
3
- "version": "0.10.0",
3
+ "version": "0.10.1",
4
4
  "description": "Set up an AI agent with Conto spending controls",
5
5
  "bin": {
6
6
  "create-conto-agent": "bin/create-conto-agent.js",