@vellumai/assistant 0.5.11 → 0.5.13
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/Dockerfile +42 -9
- package/docs/architecture/integrations.md +34 -32
- package/node_modules/@vellumai/ces-contracts/src/__tests__/grants.test.ts +7 -7
- package/node_modules/@vellumai/ces-contracts/src/handles.ts +5 -4
- package/node_modules/@vellumai/ces-contracts/src/index.ts +7 -0
- package/node_modules/@vellumai/ces-contracts/src/rpc.ts +5 -0
- package/node_modules/@vellumai/credential-storage/src/index.ts +1 -1
- package/openapi.yaml +87 -9
- package/package.json +1 -1
- package/src/__tests__/catalog-cache.test.ts +164 -0
- package/src/__tests__/catalog-search.test.ts +61 -0
- package/src/__tests__/cli-command-risk-guard.test.ts +181 -6
- package/src/__tests__/conversation-delete-schedule-cleanup.test.ts +396 -0
- package/src/__tests__/conversation-error.test.ts +3 -2
- package/src/__tests__/credential-security-invariants.test.ts +9 -15
- package/src/__tests__/credential-vault-unit.test.ts +32 -34
- package/src/__tests__/credential-vault.test.ts +25 -33
- package/src/__tests__/credentials-cli.test.ts +3 -3
- package/src/__tests__/daemon-credential-client.test.ts +2 -2
- package/src/__tests__/first-greeting.test.ts +7 -0
- package/src/__tests__/host-bash-proxy.test.ts +79 -0
- package/src/__tests__/host-cu-proxy.test.ts +90 -0
- package/src/__tests__/host-file-proxy.test.ts +89 -0
- package/src/__tests__/integration-status.test.ts +5 -5
- package/src/__tests__/list-messages-attachments.test.ts +171 -0
- package/src/__tests__/mcp-abort-signal.test.ts +205 -0
- package/src/__tests__/messaging-send-tool.test.ts +5 -5
- package/src/__tests__/navigate-settings-tab.test.ts +6 -2
- package/src/__tests__/notification-telegram-adapter.test.ts +125 -0
- package/src/__tests__/oauth-cli.test.ts +126 -119
- package/src/__tests__/oauth-provider-profiles.test.ts +55 -20
- package/src/__tests__/oauth-scope-policy.test.ts +4 -6
- package/src/__tests__/onboarding-template-contract.test.ts +2 -2
- package/src/__tests__/platform.test.ts +3 -168
- package/src/__tests__/secret-routes-managed-proxy.test.ts +78 -0
- package/src/__tests__/secure-keys-managed-failover.test.ts +73 -0
- package/src/__tests__/skill-feature-flags.test.ts +8 -0
- package/src/__tests__/skill-secret-handling-guard.test.ts +212 -0
- package/src/__tests__/skills-uninstall.test.ts +2 -2
- package/src/__tests__/slack-messaging-token-resolution.test.ts +22 -24
- package/src/__tests__/slack-share-routes.test.ts +5 -5
- package/src/__tests__/system-prompt.test.ts +39 -0
- package/src/__tests__/token-estimator-accuracy.benchmark.test.ts +1 -1
- package/src/__tests__/workspace-migration-backfill-installation-id.test.ts +5 -4
- package/src/cli/AGENTS.md +47 -7
- package/src/cli/commands/browser-relay.ts +2 -17
- package/src/cli/commands/contacts.ts +6 -4
- package/src/cli/commands/conversations.ts +13 -1
- package/src/cli/commands/credential-execution.ts +16 -1
- package/src/cli/commands/credentials.ts +2 -8
- package/src/cli/commands/oauth/__tests__/connect.test.ts +29 -108
- package/src/cli/commands/oauth/__tests__/disconnect.test.ts +13 -87
- package/src/cli/commands/oauth/__tests__/mode.test.ts +22 -69
- package/src/cli/commands/oauth/__tests__/ping.test.ts +20 -79
- package/src/cli/commands/oauth/__tests__/providers-delete.test.ts +574 -0
- package/src/cli/commands/oauth/__tests__/providers-update.test.ts +416 -0
- package/src/cli/commands/oauth/__tests__/status.test.ts +12 -40
- package/src/cli/commands/oauth/__tests__/token.test.ts +3 -50
- package/src/cli/commands/oauth/apps.ts +63 -44
- package/src/cli/commands/oauth/connect.ts +187 -155
- package/src/cli/commands/oauth/disconnect.ts +27 -75
- package/src/cli/commands/oauth/index.ts +36 -46
- package/src/cli/commands/oauth/mode.ts +22 -34
- package/src/cli/commands/oauth/ping.ts +19 -45
- package/src/cli/commands/oauth/providers.ts +569 -62
- package/src/cli/commands/oauth/request.ts +36 -48
- package/src/cli/commands/oauth/shared.ts +1 -19
- package/src/cli/commands/oauth/status.ts +14 -25
- package/src/cli/commands/oauth/token.ts +25 -34
- package/src/cli/commands/platform/__tests__/connect.test.ts +224 -0
- package/src/cli/commands/platform/__tests__/disconnect.test.ts +237 -0
- package/src/cli/commands/platform/__tests__/status.test.ts +246 -0
- package/src/cli/commands/platform/connect.ts +104 -0
- package/src/cli/commands/platform/disconnect.ts +118 -0
- package/src/cli/commands/{platform.ts → platform/index.ts} +108 -38
- package/src/cli/commands/sequence.ts +5 -4
- package/src/cli/commands/shotgun.ts +16 -0
- package/src/cli/commands/skills.ts +173 -41
- package/src/cli/commands/usage.ts +5 -11
- package/src/cli/lib/daemon-credential-client.ts +22 -38
- package/src/cli/program.ts +1 -1
- package/src/config/assistant-feature-flags.ts +3 -7
- package/src/config/bundled-skills/contacts/tools/google-contacts.ts +1 -1
- package/src/config/bundled-skills/conversations/SKILL.md +20 -0
- package/src/config/bundled-skills/conversations/TOOLS.json +23 -0
- package/src/config/bundled-skills/conversations/tools/rename-conversation.ts +66 -0
- package/src/config/bundled-skills/gmail/SKILL.md +13 -13
- package/src/config/bundled-skills/gmail/tools/gmail-archive.ts +3 -3
- package/src/config/bundled-skills/gmail/tools/gmail-attachments.ts +2 -2
- package/src/config/bundled-skills/gmail/tools/gmail-draft.ts +1 -1
- package/src/config/bundled-skills/gmail/tools/gmail-filters.ts +1 -1
- package/src/config/bundled-skills/gmail/tools/gmail-follow-up.ts +1 -1
- package/src/config/bundled-skills/gmail/tools/gmail-forward.ts +1 -1
- package/src/config/bundled-skills/gmail/tools/gmail-label.ts +2 -2
- package/src/config/bundled-skills/gmail/tools/gmail-outreach-scan.ts +1 -1
- package/src/config/bundled-skills/gmail/tools/gmail-send-draft.ts +1 -1
- package/src/config/bundled-skills/gmail/tools/gmail-sender-digest.ts +1 -1
- package/src/config/bundled-skills/gmail/tools/gmail-trash.ts +1 -1
- package/src/config/bundled-skills/gmail/tools/gmail-unsubscribe.ts +1 -1
- package/src/config/bundled-skills/gmail/tools/gmail-vacation.ts +1 -1
- package/src/config/bundled-skills/google-calendar/SKILL.md +10 -4
- package/src/config/bundled-skills/google-calendar/tools/shared.ts +1 -1
- package/src/config/bundled-skills/messaging/SKILL.md +7 -7
- package/src/config/bundled-skills/messaging/tools/messaging-send.ts +5 -2
- package/src/config/bundled-skills/messaging/tools/shared.ts +5 -6
- package/src/config/bundled-skills/settings/TOOLS.json +5 -3
- package/src/config/bundled-skills/settings/tools/navigate-settings-tab.ts +4 -2
- package/src/config/bundled-tool-registry.ts +5 -0
- package/src/config/feature-flag-registry.json +2 -2
- package/src/credential-execution/client.ts +15 -3
- package/src/daemon/conversation-agent-loop.ts +2 -0
- package/src/daemon/conversation-error.ts +36 -6
- package/src/daemon/conversation-messaging.ts +9 -0
- package/src/daemon/conversation-runtime-assembly.ts +33 -0
- package/src/daemon/conversation-surfaces.ts +120 -14
- package/src/daemon/conversation.ts +5 -0
- package/src/daemon/first-greeting.ts +6 -1
- package/src/daemon/handlers/skills.ts +148 -3
- package/src/daemon/host-bash-proxy.ts +16 -0
- package/src/daemon/host-cu-proxy.ts +16 -0
- package/src/daemon/host-file-proxy.ts +16 -0
- package/src/daemon/lifecycle.ts +56 -5
- package/src/daemon/message-types/conversations.ts +1 -0
- package/src/daemon/message-types/guardian-actions.ts +2 -0
- package/src/daemon/message-types/host-bash.ts +6 -1
- package/src/daemon/message-types/host-cu.ts +6 -1
- package/src/daemon/message-types/host-file.ts +6 -1
- package/src/daemon/message-types/integrations.ts +0 -1
- package/src/daemon/server.ts +29 -2
- package/src/hooks/cli.ts +74 -0
- package/src/inbound/platform-callback-registration.ts +7 -12
- package/src/index.ts +0 -12
- package/src/mcp/client.ts +6 -1
- package/src/mcp/manager.ts +2 -1
- package/src/memory/conversation-crud.ts +92 -3
- package/src/memory/conversation-key-store.ts +26 -0
- package/src/memory/conversation-queries.ts +6 -6
- package/src/memory/db-init.ts +16 -0
- package/src/memory/journal-memory.ts +8 -2
- package/src/memory/migrations/196-messages-conversation-created-at-index.ts +9 -0
- package/src/memory/migrations/196-strip-integration-prefix-from-provider-keys.ts +186 -0
- package/src/memory/migrations/197-oauth-providers-behavior-columns.ts +29 -0
- package/src/memory/migrations/198-drop-setup-skill-id-column.ts +11 -0
- package/src/memory/migrations/index.ts +4 -0
- package/src/memory/migrations/registry.ts +8 -0
- package/src/memory/schema/oauth.ts +11 -0
- package/src/messaging/provider.ts +13 -12
- package/src/messaging/providers/gmail/adapter.ts +44 -35
- package/src/messaging/providers/slack/adapter.ts +63 -33
- package/src/messaging/providers/telegram-bot/adapter.ts +6 -8
- package/src/messaging/providers/whatsapp/adapter.ts +6 -8
- package/src/notifications/adapters/telegram.ts +78 -2
- package/src/oauth/__tests__/identity-verifier.test.ts +464 -0
- package/src/oauth/byo-connection.test.ts +22 -24
- package/src/oauth/connect-orchestrator.ts +37 -76
- package/src/oauth/connect-types.ts +7 -65
- package/src/oauth/connection-resolver.test.ts +13 -13
- package/src/oauth/connection-resolver.ts +3 -4
- package/src/oauth/identity-verifier.ts +177 -0
- package/src/oauth/oauth-store.ts +228 -3
- package/src/oauth/platform-connection.test.ts +56 -6
- package/src/oauth/platform-connection.ts +8 -1
- package/src/oauth/seed-providers.ts +247 -34
- package/src/permissions/checker.ts +127 -1
- package/src/prompts/journal-context.ts +4 -1
- package/src/prompts/system-prompt.ts +54 -9
- package/src/prompts/templates/BOOTSTRAP.md +16 -5
- package/src/providers/anthropic/client.ts +2 -33
- package/src/runtime/guardian-action-service.ts +7 -2
- package/src/runtime/http-server.ts +12 -18
- package/src/runtime/http-types.ts +8 -1
- package/src/runtime/migrations/rebind-secrets-screen.ts +2 -2
- package/src/runtime/routes/conversation-management-routes.ts +31 -0
- package/src/runtime/routes/conversation-routes.ts +79 -4
- package/src/runtime/routes/guardian-action-routes.ts +15 -2
- package/src/runtime/routes/inbound-stages/acl-enforcement.ts +21 -8
- package/src/runtime/routes/integrations/slack/share.ts +1 -1
- package/src/runtime/routes/oauth-apps.ts +2 -1
- package/src/runtime/routes/secret-routes.ts +45 -15
- package/src/runtime/routes/settings-routes.ts +12 -19
- package/src/runtime/routes/skills-routes.ts +45 -4
- package/src/schedule/integration-status.ts +2 -2
- package/src/security/ces-rpc-credential-backend.ts +19 -16
- package/src/security/oauth-completion-page.ts +153 -0
- package/src/security/oauth2.ts +3 -17
- package/src/security/secure-keys.ts +207 -7
- package/src/security/token-manager.ts +3 -6
- package/src/signals/bash.ts +6 -1
- package/src/skills/catalog-cache.ts +44 -0
- package/src/skills/catalog-search.ts +18 -0
- package/src/tools/browser/browser-manager.ts +2 -2
- package/src/tools/credentials/post-connect-hooks.ts +1 -1
- package/src/tools/credentials/vault.ts +34 -45
- package/src/tools/host-terminal/host-shell.ts +16 -3
- package/src/tools/mcp/mcp-tool-factory.ts +2 -1
- package/src/tools/skills/sandbox-runner.ts +16 -3
- package/src/tools/terminal/shell.ts +16 -3
- package/src/util/logger.ts +11 -1
- package/src/util/platform.ts +1 -91
- package/src/util/sentry-log-stream.ts +51 -0
- package/src/watcher/providers/github.ts +2 -2
- package/src/watcher/providers/gmail.ts +1 -1
- package/src/watcher/providers/google-calendar.ts +1 -1
- package/src/watcher/providers/linear.ts +2 -2
- package/src/workspace/migrations/011-backfill-installation-id.ts +5 -3
- package/src/workspace/migrations/020-rename-oauth-skill-dirs.ts +119 -0
- package/src/workspace/migrations/registry.ts +2 -0
- package/src/cli/commands/oauth/connections.ts +0 -255
- package/src/oauth/provider-behaviors.ts +0 -634
|
@@ -1,255 +0,0 @@
|
|
|
1
|
-
import { localOAuthHandle } from "@vellumai/ces-contracts/handles";
|
|
2
|
-
import type { Command } from "commander";
|
|
3
|
-
|
|
4
|
-
import {
|
|
5
|
-
fetchManagedCatalog,
|
|
6
|
-
type ManagedCredentialDescriptor,
|
|
7
|
-
} from "../../../credential-execution/managed-catalog.js";
|
|
8
|
-
import {
|
|
9
|
-
getConnection,
|
|
10
|
-
getConnectionByProvider,
|
|
11
|
-
listConnections,
|
|
12
|
-
} from "../../../oauth/oauth-store.js";
|
|
13
|
-
import { getCliLogger } from "../../logger.js";
|
|
14
|
-
import { shouldOutputJson, writeOutput } from "../../output.js";
|
|
15
|
-
|
|
16
|
-
const log = getCliLogger("cli");
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Keys that may contain secrets in an OAuth token endpoint response.
|
|
20
|
-
* These are stripped from the `metadata` field before CLI output to prevent
|
|
21
|
-
* token leakage via shell history, logs, or agent transcript capture.
|
|
22
|
-
*/
|
|
23
|
-
const REDACTED_METADATA_KEYS = new Set([
|
|
24
|
-
"access_token",
|
|
25
|
-
"refresh_token",
|
|
26
|
-
"id_token",
|
|
27
|
-
]);
|
|
28
|
-
|
|
29
|
-
/** Recursively strip secret-bearing keys from a parsed metadata object. */
|
|
30
|
-
function redactMetadata(obj: Record<string, unknown>): Record<string, unknown> {
|
|
31
|
-
const result: Record<string, unknown> = {};
|
|
32
|
-
for (const [key, value] of Object.entries(obj)) {
|
|
33
|
-
if (REDACTED_METADATA_KEYS.has(key)) {
|
|
34
|
-
result[key] = "[REDACTED]";
|
|
35
|
-
} else if (Array.isArray(value)) {
|
|
36
|
-
result[key] = value.map((item) =>
|
|
37
|
-
item && typeof item === "object" && !Array.isArray(item)
|
|
38
|
-
? redactMetadata(item as Record<string, unknown>)
|
|
39
|
-
: item,
|
|
40
|
-
);
|
|
41
|
-
} else if (value && typeof value === "object") {
|
|
42
|
-
result[key] = redactMetadata(value as Record<string, unknown>);
|
|
43
|
-
} else {
|
|
44
|
-
result[key] = value;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
return result;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
/** Parse stored JSON string fields and convert timestamps for a connection row. */
|
|
51
|
-
function formatConnectionRow(row: ReturnType<typeof getConnection>) {
|
|
52
|
-
if (!row) return row;
|
|
53
|
-
const parsed = row.metadata ? JSON.parse(row.metadata) : null;
|
|
54
|
-
return {
|
|
55
|
-
...row,
|
|
56
|
-
handle: localOAuthHandle(row.providerKey, row.id),
|
|
57
|
-
grantedScopes: row.grantedScopes ? JSON.parse(row.grantedScopes) : [],
|
|
58
|
-
metadata: parsed ? redactMetadata(parsed) : null,
|
|
59
|
-
hasRefreshToken: row.hasRefreshToken === 1,
|
|
60
|
-
createdAt: new Date(row.createdAt).toISOString(),
|
|
61
|
-
updatedAt: new Date(row.updatedAt).toISOString(),
|
|
62
|
-
expiresAt: row.expiresAt ? new Date(row.expiresAt).toISOString() : null,
|
|
63
|
-
};
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
* Format a platform-managed credential descriptor into a connection-like
|
|
68
|
-
* output row. Never includes token values — only handle references and
|
|
69
|
-
* non-secret metadata.
|
|
70
|
-
*/
|
|
71
|
-
function formatManagedConnectionRow(
|
|
72
|
-
descriptor: ManagedCredentialDescriptor,
|
|
73
|
-
): Record<string, unknown> {
|
|
74
|
-
return {
|
|
75
|
-
source: "platform",
|
|
76
|
-
handle: descriptor.handle,
|
|
77
|
-
provider: descriptor.provider,
|
|
78
|
-
connectionId: descriptor.connectionId,
|
|
79
|
-
accountInfo: descriptor.accountInfo,
|
|
80
|
-
grantedScopes: descriptor.grantedScopes,
|
|
81
|
-
status: descriptor.status,
|
|
82
|
-
};
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
export function registerConnectionCommands(oauth: Command): void {
|
|
86
|
-
const connections = oauth
|
|
87
|
-
.command("connections")
|
|
88
|
-
.description("Manage OAuth connections (active tokens and refresh state)");
|
|
89
|
-
|
|
90
|
-
connections.addHelpText(
|
|
91
|
-
"after",
|
|
92
|
-
`
|
|
93
|
-
Connections represent active OAuth sessions — an access token bound to a
|
|
94
|
-
provider through an app registration. Each connection tracks granted scopes,
|
|
95
|
-
token expiry, refresh token availability, account info, and status.
|
|
96
|
-
|
|
97
|
-
Examples:
|
|
98
|
-
$ assistant oauth connections list
|
|
99
|
-
$ assistant oauth connections list --provider integration:google
|
|
100
|
-
$ assistant oauth connections list --client-id abc123
|
|
101
|
-
$ assistant oauth connections get --id <uuid>
|
|
102
|
-
$ assistant oauth connections get --provider integration:google
|
|
103
|
-
$ assistant oauth connections get --provider integration:google --client-id abc123`,
|
|
104
|
-
);
|
|
105
|
-
|
|
106
|
-
// ---------------------------------------------------------------------------
|
|
107
|
-
// connections list
|
|
108
|
-
// ---------------------------------------------------------------------------
|
|
109
|
-
|
|
110
|
-
connections
|
|
111
|
-
.command("list")
|
|
112
|
-
.description("List all OAuth connections")
|
|
113
|
-
.option(
|
|
114
|
-
"--provider <key>",
|
|
115
|
-
"Filter by provider key (e.g. integration:google)",
|
|
116
|
-
)
|
|
117
|
-
.option("--client-id <id>", "Filter by OAuth client ID")
|
|
118
|
-
.addHelpText(
|
|
119
|
-
"after",
|
|
120
|
-
`
|
|
121
|
-
Lists all OAuth connections, optionally filtered by provider key and/or client ID.
|
|
122
|
-
|
|
123
|
-
Each connection shows its ID, provider, account info, granted scopes, token
|
|
124
|
-
expiry, refresh token availability, and status.
|
|
125
|
-
|
|
126
|
-
Examples:
|
|
127
|
-
$ assistant oauth connections list
|
|
128
|
-
$ assistant oauth connections list --provider integration:google
|
|
129
|
-
$ assistant oauth connections list --client-id abc123`,
|
|
130
|
-
)
|
|
131
|
-
.action(
|
|
132
|
-
async (opts: { provider?: string; clientId?: string }, cmd: Command) => {
|
|
133
|
-
try {
|
|
134
|
-
const rows = listConnections(opts.provider, opts.clientId).map(
|
|
135
|
-
formatConnectionRow,
|
|
136
|
-
);
|
|
137
|
-
|
|
138
|
-
// Fetch platform-managed connections (best-effort — errors do not
|
|
139
|
-
// break local listing).
|
|
140
|
-
const managedResult = await fetchManagedCatalog();
|
|
141
|
-
let managedEntries: Array<Record<string, unknown>> = [];
|
|
142
|
-
if (managedResult.ok && managedResult.descriptors.length > 0) {
|
|
143
|
-
let descriptors = managedResult.descriptors;
|
|
144
|
-
// Apply provider filter if specified. Managed descriptors use
|
|
145
|
-
// plain slugs (e.g. "google") while the CLI --provider flag uses
|
|
146
|
-
// the canonical "integration:google" format. Strip the prefix
|
|
147
|
-
// before comparing so both forms match.
|
|
148
|
-
if (opts.provider) {
|
|
149
|
-
const filterKey = opts.provider
|
|
150
|
-
.replace(/^integration:/, "")
|
|
151
|
-
.toLowerCase();
|
|
152
|
-
descriptors = descriptors.filter(
|
|
153
|
-
(d) => d.provider.toLowerCase() === filterKey,
|
|
154
|
-
);
|
|
155
|
-
}
|
|
156
|
-
managedEntries = descriptors.map(formatManagedConnectionRow);
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
if (!shouldOutputJson(cmd)) {
|
|
160
|
-
log.info(
|
|
161
|
-
`Found ${rows.length} local connection(s)` +
|
|
162
|
-
(managedEntries.length > 0
|
|
163
|
-
? `, ${managedEntries.length} platform-managed`
|
|
164
|
-
: ""),
|
|
165
|
-
);
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
writeOutput(cmd, {
|
|
169
|
-
connections: rows,
|
|
170
|
-
managedConnections: managedEntries,
|
|
171
|
-
});
|
|
172
|
-
} catch (err) {
|
|
173
|
-
const message = err instanceof Error ? err.message : String(err);
|
|
174
|
-
writeOutput(cmd, { ok: false, error: message });
|
|
175
|
-
process.exitCode = 1;
|
|
176
|
-
}
|
|
177
|
-
},
|
|
178
|
-
);
|
|
179
|
-
|
|
180
|
-
// ---------------------------------------------------------------------------
|
|
181
|
-
// connections get
|
|
182
|
-
// ---------------------------------------------------------------------------
|
|
183
|
-
|
|
184
|
-
connections
|
|
185
|
-
.command("get")
|
|
186
|
-
.description("Look up an OAuth connection by ID or provider")
|
|
187
|
-
.option(
|
|
188
|
-
"--id <id>",
|
|
189
|
-
"Connection ID (UUID) from 'assistant oauth connections list' or 'assistant oauth status <provider>'",
|
|
190
|
-
)
|
|
191
|
-
.option(
|
|
192
|
-
"--provider <key>",
|
|
193
|
-
"Provider key (e.g. integration:google) from 'assistant oauth providers list'. Returns most recent active connection.",
|
|
194
|
-
)
|
|
195
|
-
.option(
|
|
196
|
-
"--client-id <id>",
|
|
197
|
-
"Filter by OAuth client ID (used with --provider). Find IDs via 'assistant oauth apps list'.",
|
|
198
|
-
)
|
|
199
|
-
.addHelpText(
|
|
200
|
-
"after",
|
|
201
|
-
`
|
|
202
|
-
Two lookup modes are supported:
|
|
203
|
-
|
|
204
|
-
1. By connection ID:
|
|
205
|
-
$ assistant oauth connections get --id <uuid>
|
|
206
|
-
|
|
207
|
-
2. By provider (returns the most recent active connection):
|
|
208
|
-
$ assistant oauth connections get --provider integration:google
|
|
209
|
-
$ assistant oauth connections get --provider integration:google --client-id abc123
|
|
210
|
-
|
|
211
|
-
At least --id or --provider must be specified.`,
|
|
212
|
-
)
|
|
213
|
-
.action(
|
|
214
|
-
(
|
|
215
|
-
opts: { id?: string; provider?: string; clientId?: string },
|
|
216
|
-
cmd: Command,
|
|
217
|
-
) => {
|
|
218
|
-
try {
|
|
219
|
-
let row;
|
|
220
|
-
|
|
221
|
-
if (opts.id) {
|
|
222
|
-
row = getConnection(opts.id);
|
|
223
|
-
} else if (opts.provider) {
|
|
224
|
-
row = getConnectionByProvider(opts.provider, opts.clientId);
|
|
225
|
-
} else {
|
|
226
|
-
writeOutput(cmd, {
|
|
227
|
-
ok: false,
|
|
228
|
-
error:
|
|
229
|
-
"Provide --id or --provider. Run 'assistant oauth connections list' to see all connections, or 'assistant oauth status <provider>' to find connection IDs for a specific provider.",
|
|
230
|
-
});
|
|
231
|
-
process.exitCode = 1;
|
|
232
|
-
return;
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
if (!row) {
|
|
236
|
-
const source = opts.id
|
|
237
|
-
? `--id ${opts.id}`
|
|
238
|
-
: `--provider ${opts.provider}`;
|
|
239
|
-
writeOutput(cmd, {
|
|
240
|
-
ok: false,
|
|
241
|
-
error: `No connection found for ${source}. Run 'assistant oauth connections list' to see all connections, or 'assistant oauth connect <provider>' to create a new connection.`,
|
|
242
|
-
});
|
|
243
|
-
process.exitCode = 1;
|
|
244
|
-
return;
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
writeOutput(cmd, formatConnectionRow(row));
|
|
248
|
-
} catch (err) {
|
|
249
|
-
const message = err instanceof Error ? err.message : String(err);
|
|
250
|
-
writeOutput(cmd, { ok: false, error: message });
|
|
251
|
-
process.exitCode = 1;
|
|
252
|
-
}
|
|
253
|
-
},
|
|
254
|
-
);
|
|
255
|
-
}
|