@topolo/cli 0.12.8 → 0.12.10

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/dist/index.js CHANGED
@@ -4662,7 +4662,8 @@ function sleep(ms) {
4662
4662
  // src/client.ts
4663
4663
  async function buildClient(options) {
4664
4664
  const environment = options?.environment ?? selectedEnvironment();
4665
- const credential = options?.context ? await refreshContextCredentialIfNeeded(environment, options.context) : await refreshCredentialIfNeeded(environment);
4665
+ const context = options?.context ?? process.env.TOPOLO_CONTEXT?.trim();
4666
+ const credential = context ? await refreshContextCredentialIfNeeded(environment, context) : await refreshCredentialIfNeeded(environment);
4666
4667
  if (!credential) return null;
4667
4668
  const config = await readConfig();
4668
4669
  const profile = resolvedProfileConfig(config, environment);
@@ -4678,7 +4679,7 @@ async function buildClient(options) {
4678
4679
  serviceUrls: profile.serviceUrls,
4679
4680
  requireConfirmForWrites: options?.requireConfirmForWrites,
4680
4681
  ...credential.kind === "access_token" && credential.refreshToken ? {
4681
- refreshCredential: () => options?.context ? refreshContextCredentialIfNeeded(environment, options.context, { force: true }) : refreshCredentialIfNeeded(environment, { force: true })
4682
+ refreshCredential: () => context ? refreshContextCredentialIfNeeded(environment, context, { force: true }) : refreshCredentialIfNeeded(environment, { force: true })
4682
4683
  } : {},
4683
4684
  ...isDebugEnabled() ? { debug: stderrDebugLogger } : {}
4684
4685
  });
@@ -5078,7 +5079,7 @@ async function actionExecutionContext(topolo) {
5078
5079
  const source = credentialSourceFromConfig(config, environment);
5079
5080
  return createTopoloAgentExecutionContext({
5080
5081
  environment,
5081
- contextKey: source.startsWith("env:") ? null : profile.activeContext ?? null,
5082
+ contextKey: source.startsWith("env:") ? null : process.env.TOPOLO_CONTEXT?.trim() || profile.activeContext || null,
5082
5083
  identity: await topolo.identity.whoami(),
5083
5084
  serviceUrls: resolvedProfileConfig(config, environment).serviceUrls
5084
5085
  });
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@topolo/cli",
3
3
  "packageManager": "pnpm@10.17.1",
4
- "version": "0.12.8",
5
- "topoloPublishedVersion": "0.12.8",
4
+ "version": "0.12.10",
5
+ "topoloPublishedVersion": "0.12.10",
6
6
  "description": "Public command-line interface for Topolo customer organizations, developers, and agents.",
7
7
  "license": "UNLICENSED",
8
8
  "author": "Topolo",
@@ -60,6 +60,16 @@ topolo context use <organization-name|personal> --json
60
60
  topolo whoami --json
61
61
  ```
62
62
 
63
+ For CLI automation, pin each process to an exact key returned by context discovery:
64
+
65
+ ```bash
66
+ TOPOLO_CONTEXT=org:org_acme topolo --env production whoami --json
67
+ TOPOLO_CONTEXT=org:org_acme topolo --env production actions --service brand --json
68
+ ```
69
+
70
+ The CLI keeps this pin through credential refresh and never changes the shared
71
+ active context. A missing pinned credential does not select another context.
72
+
63
73
  For concurrent agents or multiple MCP connections, never coordinate by changing
64
74
  one shared active context. Register each pinned context through the CLI so it
65
75
  uses the exact bundled MCP instead of a global binary:
@@ -76,6 +86,22 @@ reads and refreshes only its pinned credential without changing the CLI or web
76
86
  session. Do not set `TOPOLO_CONTEXT` alongside an injected API key or access
77
87
  token because that credential already carries its immutable context.
78
88
 
89
+ ## Agent invocation approvals
90
+
91
+ When `topolo_run_agent` returns `state: "awaiting_approval"`, show the human the
92
+ published approval URL, then immediately call `topolo_run_agent` again with the
93
+ exact same invocation, resource context, correlation id, and idempotency key.
94
+ Set `waitForApproval: true` and `waitSeconds: 120` on that continuation call.
95
+ Do not create a second invocation or wait for the human to ask you to resume.
96
+
97
+ If the continuation call is still awaiting approval after its bounded wait,
98
+ repeat that same continuation call until the invocation becomes terminal or
99
+ the user explicitly stops the work. Approval acknowledgement is not action
100
+ completion: report success only when the invocation itself returns
101
+ `state: "completed"`, and surface terminal failure or cancellation as such.
102
+ The invocation's pinned credential context remains authoritative regardless of
103
+ which organization is open in the human's browser.
104
+
79
105
  ## Mandatory clean-room workflow
80
106
 
81
107
  For every Topolo task, follow this sequence.