@autohq/cli 0.1.237 → 0.1.239
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/agent-bridge.js +28 -1
- package/dist/index.js +88 -5
- package/package.json +1 -1
package/dist/agent-bridge.js
CHANGED
|
@@ -23340,7 +23340,7 @@ Object.assign(lookup, {
|
|
|
23340
23340
|
// package.json
|
|
23341
23341
|
var package_default = {
|
|
23342
23342
|
name: "@autohq/cli",
|
|
23343
|
-
version: "0.1.
|
|
23343
|
+
version: "0.1.239",
|
|
23344
23344
|
license: "SEE LICENSE IN README.md",
|
|
23345
23345
|
publishConfig: {
|
|
23346
23346
|
access: "public"
|
|
@@ -25315,6 +25315,24 @@ var TelegramConnectionCreateResponseSchema = external_exports.discriminatedUnion
|
|
|
25315
25315
|
})
|
|
25316
25316
|
]
|
|
25317
25317
|
);
|
|
25318
|
+
var MODEL_API_TOKEN_PROVIDERS = ["anthropic", "openai"];
|
|
25319
|
+
var ModelApiTokenProviderSchema = external_exports.enum(MODEL_API_TOKEN_PROVIDERS);
|
|
25320
|
+
var ModelProviderConnectionCreateRequestSchema = external_exports.object({
|
|
25321
|
+
organizationId: OrganizationIdSchema.optional(),
|
|
25322
|
+
provider: ModelApiTokenProviderSchema,
|
|
25323
|
+
token: external_exports.string().trim().min(1),
|
|
25324
|
+
name: ConnectionNameSchema.default("default"),
|
|
25325
|
+
/** Grant this project access to the connection once created. */
|
|
25326
|
+
allowProjectId: ProjectIdSchema.optional()
|
|
25327
|
+
});
|
|
25328
|
+
var ModelProviderConnectionCreateResponseSchema = external_exports.object({
|
|
25329
|
+
status: external_exports.literal("connected"),
|
|
25330
|
+
provider: ModelApiTokenProviderSchema,
|
|
25331
|
+
connection: ConnectionNameSchema,
|
|
25332
|
+
providerGrantId: external_exports.string().trim().min(1),
|
|
25333
|
+
organizationId: OrganizationIdSchema,
|
|
25334
|
+
message: external_exports.string().trim().min(1)
|
|
25335
|
+
});
|
|
25318
25336
|
var ConnectionAllowRequestSchema = external_exports.object({
|
|
25319
25337
|
organizationId: OrganizationIdSchema.optional(),
|
|
25320
25338
|
provider: ProviderNameSchema,
|
|
@@ -27729,6 +27747,10 @@ var ResourceReconciliationScopeSchema = external_exports.object({
|
|
|
27729
27747
|
|
|
27730
27748
|
// ../../packages/schemas/src/usage.ts
|
|
27731
27749
|
var UsageHarnessSchema = external_exports.enum(AGENT_HARNESSES);
|
|
27750
|
+
var ModelCredentialFundingSourceSchema = external_exports.enum([
|
|
27751
|
+
"platform",
|
|
27752
|
+
"tenant_provider_grant"
|
|
27753
|
+
]);
|
|
27732
27754
|
var NonNegativeTokenCountSchema = external_exports.number().int().nonnegative();
|
|
27733
27755
|
var NonNegativeUsdSchema = external_exports.number().nonnegative();
|
|
27734
27756
|
var UsageEventSchema = external_exports.object({
|
|
@@ -27754,6 +27776,11 @@ var UsageEventSchema = external_exports.object({
|
|
|
27754
27776
|
// later rate-card change never silently rewrites historical cost.
|
|
27755
27777
|
derivedCostUsd: NonNegativeUsdSchema,
|
|
27756
27778
|
pricingVersion: external_exports.string().trim().min(1),
|
|
27779
|
+
// Historical funding attribution for the model call. The provider grant id is
|
|
27780
|
+
// denormalized and nullable for platform-funded usage, matching the ledger's
|
|
27781
|
+
// no-FK audit-trail contract.
|
|
27782
|
+
fundingSource: ModelCredentialFundingSourceSchema.default("platform"),
|
|
27783
|
+
modelCredentialProviderGrantId: ProviderGrantIdSchema.nullable().default(null),
|
|
27757
27784
|
occurredAt: external_exports.string().datetime()
|
|
27758
27785
|
});
|
|
27759
27786
|
var UsageEventRecordSchema = UsageEventSchema.extend({
|
package/dist/index.js
CHANGED
|
@@ -16738,7 +16738,7 @@ var init_resources = __esm({
|
|
|
16738
16738
|
});
|
|
16739
16739
|
|
|
16740
16740
|
// ../../packages/schemas/src/connections.ts
|
|
16741
|
-
var RESOURCE_KIND_CONNECTION, ConnectionNameSchema, ProviderConnectionReferenceSchema, ProjectConnectionAllocationSpecSchema, ProjectConnectionAllocationResourceSchema, GithubConnectionAccountSchema, GithubConnectionRepositorySchema, GITHUB_CONNECTION_EVENTS, GithubConnectionEventSchema, GithubConnectionSpecSchema, ConnectionSpecSchema, ConnectionResourceSchema, ConnectionApplyRequestSchema, ConnectionStartRequestSchema, ConnectionProviderDescriptorSchema, ConnectionProviderListResponseSchema, ConnectionStartResponseSchema, TelegramConnectionCreateRequestSchema, TelegramManagerBotSummarySchema, TelegramConnectionCreateResponseSchema, ConnectionAllowRequestSchema, SlackConfigTokenRegisterRequestSchema, SlackConfigTokenRegisterResponseSchema, ConnectionAllowResponseSchema, ConnectionRemoveRequestSchema, ConnectionRemoveResponseSchema;
|
|
16741
|
+
var RESOURCE_KIND_CONNECTION, ConnectionNameSchema, ProviderConnectionReferenceSchema, ProjectConnectionAllocationSpecSchema, ProjectConnectionAllocationResourceSchema, GithubConnectionAccountSchema, GithubConnectionRepositorySchema, GITHUB_CONNECTION_EVENTS, GithubConnectionEventSchema, GithubConnectionSpecSchema, ConnectionSpecSchema, ConnectionResourceSchema, ConnectionApplyRequestSchema, ConnectionStartRequestSchema, ConnectionProviderDescriptorSchema, ConnectionProviderListResponseSchema, ConnectionStartResponseSchema, TelegramConnectionCreateRequestSchema, TelegramManagerBotSummarySchema, TelegramConnectionCreateResponseSchema, MODEL_API_TOKEN_PROVIDERS, ModelApiTokenProviderSchema, ModelProviderConnectionCreateRequestSchema, ModelProviderConnectionCreateResponseSchema, ConnectionAllowRequestSchema, SlackConfigTokenRegisterRequestSchema, SlackConfigTokenRegisterResponseSchema, ConnectionAllowResponseSchema, ConnectionRemoveRequestSchema, ConnectionRemoveResponseSchema;
|
|
16742
16742
|
var init_connections = __esm({
|
|
16743
16743
|
"../../packages/schemas/src/connections.ts"() {
|
|
16744
16744
|
"use strict";
|
|
@@ -16865,6 +16865,24 @@ var init_connections = __esm({
|
|
|
16865
16865
|
})
|
|
16866
16866
|
]
|
|
16867
16867
|
);
|
|
16868
|
+
MODEL_API_TOKEN_PROVIDERS = ["anthropic", "openai"];
|
|
16869
|
+
ModelApiTokenProviderSchema = external_exports.enum(MODEL_API_TOKEN_PROVIDERS);
|
|
16870
|
+
ModelProviderConnectionCreateRequestSchema = external_exports.object({
|
|
16871
|
+
organizationId: OrganizationIdSchema.optional(),
|
|
16872
|
+
provider: ModelApiTokenProviderSchema,
|
|
16873
|
+
token: external_exports.string().trim().min(1),
|
|
16874
|
+
name: ConnectionNameSchema.default("default"),
|
|
16875
|
+
/** Grant this project access to the connection once created. */
|
|
16876
|
+
allowProjectId: ProjectIdSchema.optional()
|
|
16877
|
+
});
|
|
16878
|
+
ModelProviderConnectionCreateResponseSchema = external_exports.object({
|
|
16879
|
+
status: external_exports.literal("connected"),
|
|
16880
|
+
provider: ModelApiTokenProviderSchema,
|
|
16881
|
+
connection: ConnectionNameSchema,
|
|
16882
|
+
providerGrantId: external_exports.string().trim().min(1),
|
|
16883
|
+
organizationId: OrganizationIdSchema,
|
|
16884
|
+
message: external_exports.string().trim().min(1)
|
|
16885
|
+
});
|
|
16868
16886
|
ConnectionAllowRequestSchema = external_exports.object({
|
|
16869
16887
|
organizationId: OrganizationIdSchema.optional(),
|
|
16870
16888
|
provider: ProviderNameSchema,
|
|
@@ -19571,7 +19589,7 @@ var init_temporal = __esm({
|
|
|
19571
19589
|
});
|
|
19572
19590
|
|
|
19573
19591
|
// ../../packages/schemas/src/usage.ts
|
|
19574
|
-
var UsageHarnessSchema, NonNegativeTokenCountSchema, NonNegativeUsdSchema, UsageEventSchema, UsageEventRecordSchema;
|
|
19592
|
+
var UsageHarnessSchema, ModelCredentialFundingSourceSchema, NonNegativeTokenCountSchema, NonNegativeUsdSchema, UsageEventSchema, UsageEventRecordSchema;
|
|
19575
19593
|
var init_usage = __esm({
|
|
19576
19594
|
"../../packages/schemas/src/usage.ts"() {
|
|
19577
19595
|
"use strict";
|
|
@@ -19579,6 +19597,10 @@ var init_usage = __esm({
|
|
|
19579
19597
|
init_agents();
|
|
19580
19598
|
init_ids();
|
|
19581
19599
|
UsageHarnessSchema = external_exports.enum(AGENT_HARNESSES);
|
|
19600
|
+
ModelCredentialFundingSourceSchema = external_exports.enum([
|
|
19601
|
+
"platform",
|
|
19602
|
+
"tenant_provider_grant"
|
|
19603
|
+
]);
|
|
19582
19604
|
NonNegativeTokenCountSchema = external_exports.number().int().nonnegative();
|
|
19583
19605
|
NonNegativeUsdSchema = external_exports.number().nonnegative();
|
|
19584
19606
|
UsageEventSchema = external_exports.object({
|
|
@@ -19604,6 +19626,11 @@ var init_usage = __esm({
|
|
|
19604
19626
|
// later rate-card change never silently rewrites historical cost.
|
|
19605
19627
|
derivedCostUsd: NonNegativeUsdSchema,
|
|
19606
19628
|
pricingVersion: external_exports.string().trim().min(1),
|
|
19629
|
+
// Historical funding attribution for the model call. The provider grant id is
|
|
19630
|
+
// denormalized and nullable for platform-funded usage, matching the ledger's
|
|
19631
|
+
// no-FK audit-trail contract.
|
|
19632
|
+
fundingSource: ModelCredentialFundingSourceSchema.default("platform"),
|
|
19633
|
+
modelCredentialProviderGrantId: ProviderGrantIdSchema.nullable().default(null),
|
|
19607
19634
|
occurredAt: external_exports.string().datetime()
|
|
19608
19635
|
});
|
|
19609
19636
|
UsageEventRecordSchema = UsageEventSchema.extend({
|
|
@@ -21114,6 +21141,30 @@ function createApiClient(input) {
|
|
|
21114
21141
|
}
|
|
21115
21142
|
return await response.json();
|
|
21116
21143
|
},
|
|
21144
|
+
async connectModelProvider(options) {
|
|
21145
|
+
const organization = await activeOrganization();
|
|
21146
|
+
const response = await authenticatedFetch(
|
|
21147
|
+
apiUrl(apiPath("/connections/model-provider"), options.apiBaseUrl),
|
|
21148
|
+
{
|
|
21149
|
+
method: "POST",
|
|
21150
|
+
headers: {
|
|
21151
|
+
"content-type": "application/json"
|
|
21152
|
+
},
|
|
21153
|
+
body: JSON.stringify({
|
|
21154
|
+
organizationId: organization.organizationId,
|
|
21155
|
+
provider: options.provider,
|
|
21156
|
+
token: options.token,
|
|
21157
|
+
...options.name ? { name: options.name } : {},
|
|
21158
|
+
...options.allowProjectId ? { allowProjectId: options.allowProjectId } : {}
|
|
21159
|
+
})
|
|
21160
|
+
},
|
|
21161
|
+
options.apiBaseUrl
|
|
21162
|
+
);
|
|
21163
|
+
if (!response.ok) {
|
|
21164
|
+
throw new Error(await responseErrorMessage(response));
|
|
21165
|
+
}
|
|
21166
|
+
return await response.json();
|
|
21167
|
+
},
|
|
21117
21168
|
async registerSlackConfigToken(options) {
|
|
21118
21169
|
const response = await authenticatedFetch(
|
|
21119
21170
|
apiUrl(apiPath("/connections/slack/config-token"), options.apiBaseUrl),
|
|
@@ -22339,7 +22390,7 @@ var init_package = __esm({
|
|
|
22339
22390
|
"package.json"() {
|
|
22340
22391
|
package_default = {
|
|
22341
22392
|
name: "@autohq/cli",
|
|
22342
|
-
version: "0.1.
|
|
22393
|
+
version: "0.1.239",
|
|
22343
22394
|
license: "SEE LICENSE IN README.md",
|
|
22344
22395
|
publishConfig: {
|
|
22345
22396
|
access: "public"
|
|
@@ -36655,6 +36706,7 @@ function cliTelegramWizardPrompter(context) {
|
|
|
36655
36706
|
}
|
|
36656
36707
|
|
|
36657
36708
|
// src/commands/connections/actions.ts
|
|
36709
|
+
var MODEL_API_TOKEN_PROVIDERS2 = /* @__PURE__ */ new Set(["anthropic", "openai"]);
|
|
36658
36710
|
async function listConnectionsAction(context, commandOptions) {
|
|
36659
36711
|
const apiBaseUrl = apiUrlFromOptions(context, commandOptions);
|
|
36660
36712
|
if (commandOptions.available) {
|
|
@@ -36683,9 +36735,9 @@ async function connectProviderAction(context, provider, commandOptions) {
|
|
|
36683
36735
|
"--config-refresh-token is only supported for the slack provider."
|
|
36684
36736
|
);
|
|
36685
36737
|
}
|
|
36686
|
-
if ((commandOptions.token || commandOptions.stdin) && provider !== "telegram") {
|
|
36738
|
+
if ((commandOptions.token || commandOptions.stdin) && provider !== "telegram" && !MODEL_API_TOKEN_PROVIDERS2.has(provider)) {
|
|
36687
36739
|
throw new Error(
|
|
36688
|
-
"--token/--stdin are only supported for
|
|
36740
|
+
"--token/--stdin are only supported for telegram, anthropic, and openai."
|
|
36689
36741
|
);
|
|
36690
36742
|
}
|
|
36691
36743
|
const allowScope = await resolveConnectAllowProject(
|
|
@@ -36720,6 +36772,37 @@ async function connectProviderAction(context, provider, commandOptions) {
|
|
|
36720
36772
|
});
|
|
36721
36773
|
return;
|
|
36722
36774
|
}
|
|
36775
|
+
if (MODEL_API_TOKEN_PROVIDERS2.has(provider)) {
|
|
36776
|
+
if (commandOptions.token && commandOptions.stdin) {
|
|
36777
|
+
throw new Error("Use only one of --token or --stdin.");
|
|
36778
|
+
}
|
|
36779
|
+
const token2 = commandOptions.token ?? (commandOptions.stdin ? await readTrimmedStream(context.stdin) : void 0);
|
|
36780
|
+
if (!token2) {
|
|
36781
|
+
const guidance = await createConnectionServiceClient(
|
|
36782
|
+
scopedContext
|
|
36783
|
+
).startConnection(provider, {
|
|
36784
|
+
allowProjectId,
|
|
36785
|
+
apiBaseUrl
|
|
36786
|
+
});
|
|
36787
|
+
context.writeOutput(guidance.message);
|
|
36788
|
+
for (const [index, step] of (guidance.steps ?? []).entries()) {
|
|
36789
|
+
context.writeOutput(` ${index + 1}. ${step}`);
|
|
36790
|
+
}
|
|
36791
|
+
return;
|
|
36792
|
+
}
|
|
36793
|
+
const result2 = await createConnectionServiceClient(
|
|
36794
|
+
scopedContext
|
|
36795
|
+
).connectModelProvider({
|
|
36796
|
+
provider,
|
|
36797
|
+
token: token2,
|
|
36798
|
+
name: commandOptions.name,
|
|
36799
|
+
allowProjectId,
|
|
36800
|
+
apiBaseUrl
|
|
36801
|
+
});
|
|
36802
|
+
context.writeOutput(result2.message);
|
|
36803
|
+
context.writeOutput(`connection/${result2.connection}`);
|
|
36804
|
+
return;
|
|
36805
|
+
}
|
|
36723
36806
|
if (commandOptions.configRefreshToken && commandOptions.wait === false) {
|
|
36724
36807
|
throw new Error(
|
|
36725
36808
|
"--config-refresh-token registers the token once the connection completes; it cannot be combined with --no-wait."
|