@siglume/api-sdk 0.10.8 → 1.0.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.
- package/README.md +97 -99
- package/dist/bin/siglume.cjs +43 -285
- package/dist/bin/siglume.cjs.map +1 -1
- package/dist/bin/siglume.js +43 -285
- package/dist/bin/siglume.js.map +1 -1
- package/dist/cli/index.cjs +43 -285
- package/dist/cli/index.cjs.map +1 -1
- package/dist/cli/index.d.cts +0 -67
- package/dist/cli/index.d.ts +0 -67
- package/dist/cli/index.js +43 -285
- package/dist/cli/index.js.map +1 -1
- package/dist/index.cjs +3 -133
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -111
- package/dist/index.d.ts +1 -111
- package/dist/index.js +3 -133
- package/dist/index.js.map +1 -1
- package/package.json +58 -58
package/dist/bin/siglume.cjs
CHANGED
|
@@ -1459,18 +1459,6 @@ function parseBundleMember(data) {
|
|
|
1459
1459
|
link_id: stringOrNull(data.link_id)
|
|
1460
1460
|
};
|
|
1461
1461
|
}
|
|
1462
|
-
function parseConnectedAccountLifecycle(data) {
|
|
1463
|
-
return {
|
|
1464
|
-
connected_account_id: String(data.connected_account_id ?? ""),
|
|
1465
|
-
provider_key: String(data.provider_key ?? ""),
|
|
1466
|
-
expires_at: stringOrNull(data.expires_at),
|
|
1467
|
-
scopes: Array.isArray(data.scopes) ? data.scopes.filter((s) => typeof s === "string") : [],
|
|
1468
|
-
refreshed_at: stringOrNull(data.refreshed_at),
|
|
1469
|
-
connection_status: stringOrNull(data.connection_status),
|
|
1470
|
-
provider_revoked: typeof data.provider_revoked === "boolean" ? data.provider_revoked : null,
|
|
1471
|
-
revoked_at: stringOrNull(data.revoked_at)
|
|
1472
|
-
};
|
|
1473
|
-
}
|
|
1474
1462
|
function parseBundle(data) {
|
|
1475
1463
|
const membersRaw = Array.isArray(data.members) ? data.members : [];
|
|
1476
1464
|
return {
|
|
@@ -1549,21 +1537,6 @@ function parseBinding(data) {
|
|
|
1549
1537
|
raw: { ...data }
|
|
1550
1538
|
};
|
|
1551
1539
|
}
|
|
1552
|
-
function parseConnectedAccount(data) {
|
|
1553
|
-
return {
|
|
1554
|
-
connected_account_id: String(data.connected_account_id ?? data.id ?? ""),
|
|
1555
|
-
provider_key: String(data.provider_key ?? ""),
|
|
1556
|
-
account_role: String(data.account_role ?? ""),
|
|
1557
|
-
display_name: stringOrNull(data.display_name),
|
|
1558
|
-
environment: stringOrNull(data.environment),
|
|
1559
|
-
connection_status: stringOrNull(data.connection_status),
|
|
1560
|
-
scopes: Array.isArray(data.scopes) ? data.scopes.filter((item) => typeof item === "string") : [],
|
|
1561
|
-
metadata: toRecord(data.metadata),
|
|
1562
|
-
created_at: stringOrNull(data.created_at),
|
|
1563
|
-
updated_at: stringOrNull(data.updated_at),
|
|
1564
|
-
raw: { ...data }
|
|
1565
|
-
};
|
|
1566
|
-
}
|
|
1567
1540
|
function parseSupportCase(data) {
|
|
1568
1541
|
return {
|
|
1569
1542
|
support_case_id: String(data.support_case_id ?? data.id ?? ""),
|
|
@@ -2602,13 +2575,6 @@ var init_client = __esm({
|
|
|
2602
2575
|
if (options.runtime_validation) {
|
|
2603
2576
|
payload.runtime_validation = coerceMapping(options.runtime_validation, "runtime_validation");
|
|
2604
2577
|
}
|
|
2605
|
-
if (options.oauth_credentials) {
|
|
2606
|
-
payload.oauth_credentials = Array.isArray(options.oauth_credentials) ? {
|
|
2607
|
-
items: options.oauth_credentials.map(
|
|
2608
|
-
(item, index) => coerceMapping(item, `oauth_credentials[${index}]`)
|
|
2609
|
-
)
|
|
2610
|
-
} : coerceMapping(options.oauth_credentials, "oauth_credentials");
|
|
2611
|
-
}
|
|
2612
2578
|
if (options.source_context) {
|
|
2613
2579
|
payload.source_context = coerceMapping(options.source_context, "source_context");
|
|
2614
2580
|
}
|
|
@@ -2738,7 +2704,6 @@ var init_client = __esm({
|
|
|
2738
2704
|
auto_manifest: toRecord(data.auto_manifest),
|
|
2739
2705
|
confidence: toRecord(data.confidence),
|
|
2740
2706
|
validation_report: toRecord(data.validation_report),
|
|
2741
|
-
oauth_status: toRecord(data.oauth_status),
|
|
2742
2707
|
review_url: stringOrNull(data.review_url),
|
|
2743
2708
|
trace_id: meta.trace_id,
|
|
2744
2709
|
request_id: meta.request_id
|
|
@@ -2914,66 +2879,9 @@ var init_client = __esm({
|
|
|
2914
2879
|
return parseBundle(data);
|
|
2915
2880
|
}
|
|
2916
2881
|
// ----- end bundles -------------------------------------------------------
|
|
2917
|
-
// ----- Connected accounts
|
|
2918
|
-
//
|
|
2919
|
-
|
|
2920
|
-
const body = {
|
|
2921
|
-
listing_id: input.listing_id,
|
|
2922
|
-
redirect_uri: input.redirect_uri
|
|
2923
|
-
};
|
|
2924
|
-
if (input.scopes !== void 0) body.scopes = input.scopes;
|
|
2925
|
-
if (input.account_role !== void 0) body.account_role = input.account_role;
|
|
2926
|
-
const [data] = await this.request("POST", "/me/connected-accounts/oauth/authorize", {
|
|
2927
|
-
json_body: body
|
|
2928
|
-
});
|
|
2929
|
-
return {
|
|
2930
|
-
authorize_url: String(data.authorize_url ?? ""),
|
|
2931
|
-
state: String(data.state ?? ""),
|
|
2932
|
-
provider_key: String(data.provider_key ?? ""),
|
|
2933
|
-
scopes: Array.isArray(data.scopes) ? data.scopes.filter((s) => typeof s === "string") : [],
|
|
2934
|
-
pkce_method: stringOrNull(data.pkce_method)
|
|
2935
|
-
};
|
|
2936
|
-
}
|
|
2937
|
-
async complete_connected_account_oauth(input) {
|
|
2938
|
-
const [data] = await this.request("POST", "/me/connected-accounts/oauth/callback", {
|
|
2939
|
-
json_body: { state: input.state, code: input.code }
|
|
2940
|
-
});
|
|
2941
|
-
return { ...data };
|
|
2942
|
-
}
|
|
2943
|
-
async refresh_connected_account(account_id) {
|
|
2944
|
-
const [data] = await this.request("POST", `/me/connected-accounts/${account_id}/refresh`);
|
|
2945
|
-
return parseConnectedAccountLifecycle(data);
|
|
2946
|
-
}
|
|
2947
|
-
async revoke_connected_account(account_id) {
|
|
2948
|
-
const [data] = await this.request("POST", `/me/connected-accounts/${account_id}/revoke`);
|
|
2949
|
-
return parseConnectedAccountLifecycle(data);
|
|
2950
|
-
}
|
|
2951
|
-
async set_listing_oauth_credentials(listing_id, input) {
|
|
2952
|
-
const body = {
|
|
2953
|
-
provider_key: input.provider_key,
|
|
2954
|
-
client_id: input.client_id,
|
|
2955
|
-
client_secret: input.client_secret,
|
|
2956
|
-
authorize_url: input.authorize_url,
|
|
2957
|
-
token_url: input.token_url
|
|
2958
|
-
};
|
|
2959
|
-
if (input.revoke_url !== void 0) body.revoke_url = input.revoke_url;
|
|
2960
|
-
if (input.display_name !== void 0) body.display_name = input.display_name;
|
|
2961
|
-
if (input.scope_separator !== void 0) body.scope_separator = input.scope_separator;
|
|
2962
|
-
if (input.token_endpoint_auth !== void 0) body.token_endpoint_auth = input.token_endpoint_auth;
|
|
2963
|
-
if (input.pkce_required !== void 0) body.pkce_required = input.pkce_required;
|
|
2964
|
-
if (input.refresh_supported !== void 0) body.refresh_supported = input.refresh_supported;
|
|
2965
|
-
if (input.available_scopes !== void 0) body.available_scopes = input.available_scopes;
|
|
2966
|
-
if (input.required_scopes !== void 0) body.required_scopes = input.required_scopes;
|
|
2967
|
-
const [data] = await this.request("PUT", `/market/capabilities/${listing_id}/oauth-credentials`, {
|
|
2968
|
-
json_body: body
|
|
2969
|
-
});
|
|
2970
|
-
return { ...data };
|
|
2971
|
-
}
|
|
2972
|
-
async get_listing_oauth_credentials_status(listing_id) {
|
|
2973
|
-
const [data] = await this.request("GET", `/market/capabilities/${listing_id}/oauth-credentials`);
|
|
2974
|
-
return { ...data };
|
|
2975
|
-
}
|
|
2976
|
-
// ----- end connected accounts --------------------------------------------
|
|
2882
|
+
// ----- Connected accounts ------------------------------------------------
|
|
2883
|
+
// Architecture B: publisher APIs own external OAuth and token storage.
|
|
2884
|
+
// The SDK no longer exposes platform OAuth or listing credential APIs.
|
|
2977
2885
|
async get_developer_portal() {
|
|
2978
2886
|
const [data, meta] = await this.request("GET", "/market/developer/portal");
|
|
2979
2887
|
return {
|
|
@@ -3006,7 +2914,6 @@ var init_client = __esm({
|
|
|
3006
2914
|
dry_run_supported: Boolean(data.dry_run_supported ?? false),
|
|
3007
2915
|
approval_mode: stringOrNull(data.approval_mode),
|
|
3008
2916
|
required_connected_accounts: Array.isArray(data.required_connected_accounts) ? data.required_connected_accounts : [],
|
|
3009
|
-
connected_accounts: Array.isArray(data.connected_accounts) ? data.connected_accounts.filter((item) => isRecord(item)).map((item) => ({ ...item })) : [],
|
|
3010
2917
|
stub_providers_enabled: Boolean(data.stub_providers_enabled ?? false),
|
|
3011
2918
|
simulated_receipts: Boolean(data.simulated_receipts ?? false),
|
|
3012
2919
|
approval_simulator: Boolean(data.approval_simulator ?? false),
|
|
@@ -4304,25 +4211,6 @@ var init_client = __esm({
|
|
|
4304
4211
|
raw: { ...data }
|
|
4305
4212
|
};
|
|
4306
4213
|
}
|
|
4307
|
-
async list_connected_accounts(options = {}) {
|
|
4308
|
-
const params = {
|
|
4309
|
-
provider_key: options.provider_key,
|
|
4310
|
-
environment: options.environment,
|
|
4311
|
-
limit: Math.max(1, Math.min(Math.trunc(options.limit ?? 50), 100)),
|
|
4312
|
-
cursor: options.cursor
|
|
4313
|
-
};
|
|
4314
|
-
const [data, meta] = await this.request("GET", "/market/connected-accounts", { params });
|
|
4315
|
-
const items = Array.isArray(data.items) ? data.items.filter((item) => isRecord(item)).map(parseConnectedAccount) : [];
|
|
4316
|
-
const next_cursor = stringOrNull(data.next_cursor);
|
|
4317
|
-
return new CursorPageResult({
|
|
4318
|
-
items,
|
|
4319
|
-
next_cursor,
|
|
4320
|
-
limit: typeof data.limit === "number" ? data.limit : params.limit,
|
|
4321
|
-
offset: typeof data.offset === "number" ? data.offset : null,
|
|
4322
|
-
meta,
|
|
4323
|
-
fetchNext: next_cursor ? (cursor) => this.list_connected_accounts({ ...options, cursor }) : void 0
|
|
4324
|
-
});
|
|
4325
|
-
}
|
|
4326
4214
|
async create_support_case(subject, body, options = {}) {
|
|
4327
4215
|
const summary = subject.trim();
|
|
4328
4216
|
const details = body.trim();
|
|
@@ -6166,24 +6054,12 @@ var AppTestHarness = class {
|
|
|
6166
6054
|
this.stubs = stubs;
|
|
6167
6055
|
}
|
|
6168
6056
|
async executeWithKind(execution_kind, task_type = "default", options = {}) {
|
|
6169
|
-
const connected_accounts = options.connected_accounts ?? Object.fromEntries(
|
|
6170
|
-
Object.keys(this.stubs).map((key) => [
|
|
6171
|
-
key,
|
|
6172
|
-
{
|
|
6173
|
-
provider_key: key,
|
|
6174
|
-
session_token: `stub-token-${key}`,
|
|
6175
|
-
environment: Environment.SANDBOX,
|
|
6176
|
-
scopes: []
|
|
6177
|
-
}
|
|
6178
|
-
])
|
|
6179
|
-
);
|
|
6180
6057
|
const ctx = {
|
|
6181
6058
|
agent_id: "test-agent-001",
|
|
6182
6059
|
owner_user_id: "test-owner-001",
|
|
6183
6060
|
task_type,
|
|
6184
6061
|
environment: Environment.SANDBOX,
|
|
6185
6062
|
execution_kind,
|
|
6186
|
-
connected_accounts,
|
|
6187
6063
|
input_params: options.input_params ?? {},
|
|
6188
6064
|
trace_id: options.trace_id,
|
|
6189
6065
|
idempotency_key: options.idempotency_key,
|
|
@@ -6273,12 +6149,6 @@ var AppTestHarness = class {
|
|
|
6273
6149
|
}
|
|
6274
6150
|
return issues;
|
|
6275
6151
|
}
|
|
6276
|
-
async simulate_connected_account_missing(task_type = "default", options = {}) {
|
|
6277
|
-
return this.executeWithKind("dry_run", task_type, {
|
|
6278
|
-
...options,
|
|
6279
|
-
connected_accounts: {}
|
|
6280
|
-
});
|
|
6281
|
-
}
|
|
6282
6152
|
async simulate_metering(record, options = {}) {
|
|
6283
6153
|
const { normalizeUsageRecord: normalizeUsageRecord2 } = await Promise.resolve().then(() => (init_metering(), metering_exports));
|
|
6284
6154
|
const manifest = await this.app.manifest();
|
|
@@ -7241,15 +7111,6 @@ async function loadProject(path = ".") {
|
|
|
7241
7111
|
const tool_manual = tool_manual_path ? JSON.parse(await (0, import_promises.readFile)(tool_manual_path, "utf8")) : buildToolManualTemplate(manifest);
|
|
7242
7112
|
const runtime_validation_path = await findRuntimeValidationPath(root_dir);
|
|
7243
7113
|
const runtime_validation = runtime_validation_path ? await loadJsonObject(runtime_validation_path, "runtime_validation") : void 0;
|
|
7244
|
-
const oauth_credentials_path = await findOauthCredentialsPath(root_dir);
|
|
7245
|
-
let oauth_credentials;
|
|
7246
|
-
if (oauth_credentials_path) {
|
|
7247
|
-
const parsed = JSON.parse(await (0, import_promises.readFile)(oauth_credentials_path, "utf8"));
|
|
7248
|
-
if (!isRecord(parsed) && !Array.isArray(parsed)) {
|
|
7249
|
-
throw new SiglumeProjectError("oauth_credentials must be a JSON object or array");
|
|
7250
|
-
}
|
|
7251
|
-
oauth_credentials = parsed;
|
|
7252
|
-
}
|
|
7253
7114
|
return {
|
|
7254
7115
|
root_dir,
|
|
7255
7116
|
adapter_path,
|
|
@@ -7258,9 +7119,7 @@ async function loadProject(path = ".") {
|
|
|
7258
7119
|
tool_manual_path: tool_manual_path ?? void 0,
|
|
7259
7120
|
tool_manual,
|
|
7260
7121
|
runtime_validation_path: runtime_validation_path ?? void 0,
|
|
7261
|
-
runtime_validation
|
|
7262
|
-
oauth_credentials_path: oauth_credentials_path ?? void 0,
|
|
7263
|
-
oauth_credentials
|
|
7122
|
+
runtime_validation
|
|
7264
7123
|
};
|
|
7265
7124
|
}
|
|
7266
7125
|
function isPlatformManagedRequirement(value) {
|
|
@@ -7298,6 +7157,21 @@ function requiredOauthProviders(requirements) {
|
|
|
7298
7157
|
}
|
|
7299
7158
|
return providers;
|
|
7300
7159
|
}
|
|
7160
|
+
function apiManagedRequirementsMissingConnectUrl(requirements) {
|
|
7161
|
+
const missing = [];
|
|
7162
|
+
for (const item of requirements ?? []) {
|
|
7163
|
+
if (!isRecord(item)) continue;
|
|
7164
|
+
const managedBy = String(item.managed_by ?? "").trim().toLowerCase().replaceAll("_", "-");
|
|
7165
|
+
if (managedBy !== "api") continue;
|
|
7166
|
+
const connectUrl = String(item.connect_url ?? "").trim();
|
|
7167
|
+
if (connectUrl) continue;
|
|
7168
|
+
const label = oauthProviderKeyFromRequirement(item) ?? "(missing provider_key)";
|
|
7169
|
+
if (!missing.includes(label)) {
|
|
7170
|
+
missing.push(label);
|
|
7171
|
+
}
|
|
7172
|
+
}
|
|
7173
|
+
return missing;
|
|
7174
|
+
}
|
|
7301
7175
|
function connectedAccountRequirementLabel(value) {
|
|
7302
7176
|
if (isRecord(value)) {
|
|
7303
7177
|
for (const key of ["provider_key", "provider", "account_type", "name"]) {
|
|
@@ -7308,102 +7182,6 @@ function connectedAccountRequirementLabel(value) {
|
|
|
7308
7182
|
}
|
|
7309
7183
|
return String(value ?? "").trim();
|
|
7310
7184
|
}
|
|
7311
|
-
function oauthProviderRecordsMap(payload) {
|
|
7312
|
-
if (!payload) {
|
|
7313
|
-
return {};
|
|
7314
|
-
}
|
|
7315
|
-
const items = Array.isArray(payload) ? payload : Array.isArray(payload.items) ? payload.items : [payload];
|
|
7316
|
-
const resolved = {};
|
|
7317
|
-
for (const [index, item] of items.entries()) {
|
|
7318
|
-
if (!isRecord(item)) {
|
|
7319
|
-
throw new SiglumeProjectError(`oauth_credentials[${index}] must be a JSON object.`);
|
|
7320
|
-
}
|
|
7321
|
-
const providerKey = oauthProviderKeyFromRequirement(item.provider_key ?? item.provider);
|
|
7322
|
-
if (!providerKey) {
|
|
7323
|
-
throw new SiglumeProjectError(`oauth_credentials[${index}].provider_key is required.`);
|
|
7324
|
-
}
|
|
7325
|
-
const authorizeUrl = String(item.authorize_url ?? item.authorization_url ?? item.auth_url ?? "").trim();
|
|
7326
|
-
const tokenUrl = String(item.token_url ?? "").trim();
|
|
7327
|
-
if (!authorizeUrl || !tokenUrl) {
|
|
7328
|
-
throw new SiglumeProjectError(
|
|
7329
|
-
`oauth_credentials[${index}] must include authorize_url and token_url.`
|
|
7330
|
-
);
|
|
7331
|
-
}
|
|
7332
|
-
for (const [urlKey, urlValue] of Object.entries({
|
|
7333
|
-
authorize_url: authorizeUrl,
|
|
7334
|
-
token_url: tokenUrl,
|
|
7335
|
-
revoke_url: String(item.revoke_url ?? "").trim()
|
|
7336
|
-
})) {
|
|
7337
|
-
if (urlValue && !urlValue.startsWith("https://")) {
|
|
7338
|
-
throw new SiglumeProjectError(`oauth_credentials[${index}].${urlKey} must be an https URL.`);
|
|
7339
|
-
}
|
|
7340
|
-
}
|
|
7341
|
-
const clientId = String(item.client_id ?? "").trim();
|
|
7342
|
-
const clientSecret = String(item.client_secret ?? "").trim();
|
|
7343
|
-
if (!clientId || !clientSecret) {
|
|
7344
|
-
throw new SiglumeProjectError(`oauth_credentials[${index}] must include client_id and client_secret.`);
|
|
7345
|
-
}
|
|
7346
|
-
const rawScopes = item.required_scopes ?? item.scopes;
|
|
7347
|
-
let scopes = [];
|
|
7348
|
-
if (rawScopes == null) {
|
|
7349
|
-
scopes = [];
|
|
7350
|
-
} else if (!Array.isArray(rawScopes)) {
|
|
7351
|
-
throw new SiglumeProjectError(`oauth_credentials[${index}].required_scopes must be a JSON array.`);
|
|
7352
|
-
} else {
|
|
7353
|
-
scopes = rawScopes.map((scope) => String(scope ?? "").trim()).filter(Boolean);
|
|
7354
|
-
}
|
|
7355
|
-
const record = {
|
|
7356
|
-
provider_key: providerKey,
|
|
7357
|
-
client_id: clientId,
|
|
7358
|
-
client_secret: clientSecret,
|
|
7359
|
-
required_scopes: scopes
|
|
7360
|
-
};
|
|
7361
|
-
for (const [key, value] of Object.entries({
|
|
7362
|
-
authorize_url: authorizeUrl,
|
|
7363
|
-
token_url: tokenUrl,
|
|
7364
|
-
revoke_url: String(item.revoke_url ?? "").trim(),
|
|
7365
|
-
display_name: String(item.display_name ?? "").trim(),
|
|
7366
|
-
scope_separator: String(item.scope_separator ?? "").trim(),
|
|
7367
|
-
token_endpoint_auth: String(item.token_endpoint_auth ?? "").trim()
|
|
7368
|
-
})) {
|
|
7369
|
-
if (value) record[key] = value;
|
|
7370
|
-
}
|
|
7371
|
-
for (const key of ["pkce_required", "refresh_supported"]) {
|
|
7372
|
-
if (typeof item[key] === "boolean") record[key] = item[key];
|
|
7373
|
-
}
|
|
7374
|
-
if (Array.isArray(item.available_scopes)) {
|
|
7375
|
-
const availableScopes = item.available_scopes.map((scope) => String(scope ?? "").trim()).filter(Boolean);
|
|
7376
|
-
if (availableScopes.length > 0) record.available_scopes = availableScopes;
|
|
7377
|
-
}
|
|
7378
|
-
resolved[providerKey] = record;
|
|
7379
|
-
}
|
|
7380
|
-
return resolved;
|
|
7381
|
-
}
|
|
7382
|
-
function canonicalOauthCredentialsPayload(payload) {
|
|
7383
|
-
const records = oauthProviderRecordsMap(payload);
|
|
7384
|
-
const providerKeys = Object.keys(records).sort();
|
|
7385
|
-
if (providerKeys.length === 0) {
|
|
7386
|
-
return void 0;
|
|
7387
|
-
}
|
|
7388
|
-
return {
|
|
7389
|
-
items: providerKeys.map((providerKey) => records[providerKey])
|
|
7390
|
-
};
|
|
7391
|
-
}
|
|
7392
|
-
function ensureRequiredOauthCredentials(project) {
|
|
7393
|
-
const requiredProviders = requiredOauthProviders(project.manifest.required_connected_accounts ?? []);
|
|
7394
|
-
if (requiredProviders.length === 0) {
|
|
7395
|
-
return;
|
|
7396
|
-
}
|
|
7397
|
-
const provided = new Set(Object.keys(oauthProviderRecordsMap(project.oauth_credentials)));
|
|
7398
|
-
const missing = requiredProviders.filter((provider) => !provided.has(provider));
|
|
7399
|
-
if (missing.length === 0) {
|
|
7400
|
-
return;
|
|
7401
|
-
}
|
|
7402
|
-
const path = project.oauth_credentials_path ?? (0, import_node_path.join)(project.root_dir, "oauth_credentials.json");
|
|
7403
|
-
throw new SiglumeProjectError(
|
|
7404
|
-
`${path} is required for platform-managed OAuth APIs. Missing provider seeds: ${missing.join(", ")}`
|
|
7405
|
-
);
|
|
7406
|
-
}
|
|
7407
7185
|
async function validateProject(path = ".", deps = {}) {
|
|
7408
7186
|
const project = await loadProject(path);
|
|
7409
7187
|
const manifest_issues = await projectValidationIssues(project);
|
|
@@ -7558,10 +7336,21 @@ function ensureExplicitToolManual(project) {
|
|
|
7558
7336
|
async function registrationPreflight(project, client) {
|
|
7559
7337
|
const manifestIssues = await projectValidationIssues(project);
|
|
7560
7338
|
const [toolManualValid, toolManualIssues] = validate_tool_manual(project.tool_manual);
|
|
7339
|
+
const retiredPlatformOauthProviders = requiredOauthProviders(project.manifest.required_connected_accounts ?? []);
|
|
7340
|
+
if (retiredPlatformOauthProviders.length > 0) {
|
|
7341
|
+
throw new SiglumeProjectError(
|
|
7342
|
+
`Registration preflight failed. Fix these before calling auto-register:
|
|
7343
|
+
- platform-managed OAuth is retired. Use managed_by="api" with connect_url: ${retiredPlatformOauthProviders.join(", ")}`
|
|
7344
|
+
);
|
|
7345
|
+
}
|
|
7346
|
+
const apiManagedMissingConnectUrl = apiManagedRequirementsMissingConnectUrl(project.manifest.required_connected_accounts ?? []);
|
|
7347
|
+
if (apiManagedMissingConnectUrl.length > 0) {
|
|
7348
|
+
throw new SiglumeProjectError(
|
|
7349
|
+
`Registration preflight failed. Fix these before calling auto-register:
|
|
7350
|
+
- API-managed OAuth requirements must include connect_url: ${apiManagedMissingConnectUrl.join(", ")}`
|
|
7351
|
+
);
|
|
7352
|
+
}
|
|
7561
7353
|
const remoteQuality = await client.preview_quality_score(project.tool_manual);
|
|
7562
|
-
const requiredOauthProvidersList = requiredOauthProviders(project.manifest.required_connected_accounts ?? []);
|
|
7563
|
-
const oauthProviderRecords = oauthProviderRecordsMap(project.oauth_credentials);
|
|
7564
|
-
const missingOauthProviders = requiredOauthProvidersList.filter((provider) => !oauthProviderRecords[provider]);
|
|
7565
7354
|
const blockingToolManualIssues = toolManualIssues.filter((issue2) => issue2.severity === "error");
|
|
7566
7355
|
const errors = [
|
|
7567
7356
|
...manifestIssues.map((issue2) => String(issue2)),
|
|
@@ -7573,17 +7362,12 @@ async function registrationPreflight(project, client) {
|
|
|
7573
7362
|
if (!remoteQualityOk(remoteQuality)) {
|
|
7574
7363
|
errors.push(`remote Tool Manual quality is not publishable: ${remoteQuality.grade} (${remoteQuality.overall_score}/100)`);
|
|
7575
7364
|
}
|
|
7576
|
-
if (missingOauthProviders.length > 0) {
|
|
7577
|
-
errors.push(`oauth_credentials.json is required for platform-managed OAuth APIs: ${missingOauthProviders.join(", ")}`);
|
|
7578
|
-
}
|
|
7579
7365
|
const preflight = {
|
|
7580
7366
|
manifest_issues: manifestIssues,
|
|
7581
7367
|
tool_manual_valid: toolManualValid,
|
|
7582
7368
|
tool_manual_issues: toolManualIssues.map((issue2) => toJsonable(issue2)),
|
|
7583
7369
|
remote_quality: toJsonable(remoteQuality),
|
|
7584
|
-
|
|
7585
|
-
oauth_credentials_path: project.oauth_credentials_path ?? null,
|
|
7586
|
-
oauth_missing_providers: missingOauthProviders,
|
|
7370
|
+
retired_platform_oauth_providers: retiredPlatformOauthProviders,
|
|
7587
7371
|
ok: errors.length === 0
|
|
7588
7372
|
};
|
|
7589
7373
|
if (errors.length > 0) {
|
|
@@ -7622,8 +7406,6 @@ async function runRegistration(path = ".", options = {}, deps = {}) {
|
|
|
7622
7406
|
ensureExplicitToolManual(project);
|
|
7623
7407
|
ensureManifestPublisherIdentity(project);
|
|
7624
7408
|
ensureRuntimeValidationReady(project);
|
|
7625
|
-
ensureRequiredOauthCredentials(project);
|
|
7626
|
-
const canonicalOauthCredentials = canonicalOauthCredentialsPayload(project.oauth_credentials);
|
|
7627
7409
|
const client = await createClient(deps);
|
|
7628
7410
|
if (requestedCompanySlug) {
|
|
7629
7411
|
const slug = companyNameSlug(requestedCompanySlug);
|
|
@@ -7700,14 +7482,12 @@ async function runRegistration(path = ".", options = {}, deps = {}) {
|
|
|
7700
7482
|
}
|
|
7701
7483
|
}
|
|
7702
7484
|
const receipt = await client.auto_register(project.manifest, project.tool_manual, {
|
|
7703
|
-
runtime_validation: project.runtime_validation
|
|
7704
|
-
oauth_credentials: canonicalOauthCredentials
|
|
7485
|
+
runtime_validation: project.runtime_validation
|
|
7705
7486
|
});
|
|
7706
7487
|
const result = {
|
|
7707
7488
|
receipt: toJsonable(receipt),
|
|
7708
7489
|
registration_preflight: preflight,
|
|
7709
|
-
runtime_validation_path: project.runtime_validation_path ?? null
|
|
7710
|
-
oauth_credentials_path: project.oauth_credentials_path ?? null
|
|
7490
|
+
runtime_validation_path: project.runtime_validation_path ?? null
|
|
7711
7491
|
};
|
|
7712
7492
|
if (developerPortalPreflight) {
|
|
7713
7493
|
result.developer_portal_preflight = developerPortalPreflight;
|
|
@@ -7728,7 +7508,6 @@ async function runPreflight(path = ".", deps = {}) {
|
|
|
7728
7508
|
ensureExplicitToolManual(project);
|
|
7729
7509
|
ensureManifestPublisherIdentity(project);
|
|
7730
7510
|
ensureRuntimeValidationReady(project);
|
|
7731
|
-
ensureRequiredOauthCredentials(project);
|
|
7732
7511
|
const client = await createClient(deps);
|
|
7733
7512
|
const preflight = await registrationPreflight(project, client);
|
|
7734
7513
|
let developerPortalPreflight = null;
|
|
@@ -7746,8 +7525,7 @@ async function runPreflight(path = ".", deps = {}) {
|
|
|
7746
7525
|
ok: true,
|
|
7747
7526
|
adapter_path: project.adapter_path,
|
|
7748
7527
|
registration_preflight: preflight,
|
|
7749
|
-
runtime_validation_path: project.runtime_validation_path ?? null
|
|
7750
|
-
oauth_credentials_path: project.oauth_credentials_path ?? null
|
|
7528
|
+
runtime_validation_path: project.runtime_validation_path ?? null
|
|
7751
7529
|
};
|
|
7752
7530
|
if (developerPortalPreflight) {
|
|
7753
7531
|
result.developer_portal_preflight = developerPortalPreflight;
|
|
@@ -8229,7 +8007,7 @@ function operationReadmeTemplate(operation, manifest, warning) {
|
|
|
8229
8007
|
"- `tool_manual.json`: machine-generated ToolManual scaffold",
|
|
8230
8008
|
"- `runtime_validation.json`: local public endpoint and review-key checks used by auto-register",
|
|
8231
8009
|
"- `docs/api-usage.md`: publishable API usage guide template for `docs_url`",
|
|
8232
|
-
"- `.gitignore`: keeps runtime review keys
|
|
8010
|
+
"- `.gitignore`: keeps runtime review keys out of Git",
|
|
8233
8011
|
"- `tests/test_adapter.ts`: smoke test for `AppTestHarness`",
|
|
8234
8012
|
"",
|
|
8235
8013
|
"Before registering, replace all generated placeholders:",
|
|
@@ -8237,8 +8015,8 @@ function operationReadmeTemplate(operation, manifest, warning) {
|
|
|
8237
8015
|
"- Replace `support_contact` with a real support email address or public support URL.",
|
|
8238
8016
|
"- Optional `seller_homepage_url` is the seller's official site and can stay blank.",
|
|
8239
8017
|
"- In the local `runtime_validation.json`, replace the public URL and review-key placeholders.",
|
|
8240
|
-
"- If the API uses
|
|
8241
|
-
"- Do not commit real review keys or
|
|
8018
|
+
"- If the API uses external OAuth, implement that flow in your API runtime and keep user tokens outside Siglume.",
|
|
8019
|
+
"- Do not commit real review keys or external-provider secrets; the generated `.gitignore` excludes local secret files.",
|
|
8242
8020
|
"- Because `runtime_validation.json` is ignored, GitHub samples do not commit review-key values.",
|
|
8243
8021
|
"",
|
|
8244
8022
|
"## Commands",
|
|
@@ -8314,8 +8092,6 @@ function generatedGitignore() {
|
|
|
8314
8092
|
"!.env.example",
|
|
8315
8093
|
"runtime_validation.json",
|
|
8316
8094
|
"runtime-validation.json",
|
|
8317
|
-
"oauth_credentials.json",
|
|
8318
|
-
"oauth-credentials.json",
|
|
8319
8095
|
"",
|
|
8320
8096
|
"# Python / test artifacts.",
|
|
8321
8097
|
"__pycache__/",
|
|
@@ -8461,13 +8237,6 @@ async function runHarnessForProject(project) {
|
|
|
8461
8237
|
checks.push(executionCheck("quote", await harness.execute_quote(task_type, { input_params: sample_input }), harness));
|
|
8462
8238
|
checks.push(executionCheck("payment", await harness.execute_payment(task_type, { input_params: sample_input }), harness));
|
|
8463
8239
|
}
|
|
8464
|
-
checks.push(
|
|
8465
|
-
executionCheck(
|
|
8466
|
-
"missing_account_simulation",
|
|
8467
|
-
await harness.simulate_connected_account_missing(task_type, { input_params: sample_input }),
|
|
8468
|
-
harness
|
|
8469
|
-
)
|
|
8470
|
-
);
|
|
8471
8240
|
return {
|
|
8472
8241
|
adapter_path: project.adapter_path,
|
|
8473
8242
|
task_type,
|
|
@@ -8570,15 +8339,6 @@ async function findRuntimeValidationPath(root_dir) {
|
|
|
8570
8339
|
}
|
|
8571
8340
|
return null;
|
|
8572
8341
|
}
|
|
8573
|
-
async function findOauthCredentialsPath(root_dir) {
|
|
8574
|
-
for (const name of ["oauth_credentials.json", "oauth-credentials.json"]) {
|
|
8575
|
-
const candidate = (0, import_node_path.join)(root_dir, name);
|
|
8576
|
-
if ((0, import_node_fs.existsSync)(candidate)) {
|
|
8577
|
-
return candidate;
|
|
8578
|
-
}
|
|
8579
|
-
}
|
|
8580
|
-
return null;
|
|
8581
|
-
}
|
|
8582
8342
|
async function loadJsonObject(path, label) {
|
|
8583
8343
|
let payload;
|
|
8584
8344
|
try {
|
|
@@ -8810,15 +8570,15 @@ function readmeTemplate(template) {
|
|
|
8810
8570
|
"- `tool_manual.json`: editable ToolManual draft for validation and registration",
|
|
8811
8571
|
"- `runtime_validation.json`: local live API smoke-test contract used during registration",
|
|
8812
8572
|
"- `docs/api-usage.md`: publish this page and use its public URL as `docs_url`",
|
|
8813
|
-
"- `.gitignore`: keeps runtime review keys
|
|
8573
|
+
"- `.gitignore`: keeps runtime review keys out of Git",
|
|
8814
8574
|
"",
|
|
8815
8575
|
"Before registering, replace all generated placeholders:",
|
|
8816
8576
|
"- In `adapter.ts` and `manifest.json`, replace `docs_url` with a dedicated public API usage guide, not a homepage.",
|
|
8817
8577
|
"- Replace `support_contact` with a real support email address or public support URL.",
|
|
8818
8578
|
"- Optional `seller_homepage_url` is the seller's official site and can stay blank.",
|
|
8819
8579
|
"- In the local `runtime_validation.json`, replace the public URL and review-key placeholders.",
|
|
8820
|
-
"- If the API uses
|
|
8821
|
-
"- Do not commit real review keys or
|
|
8580
|
+
"- If the API uses external OAuth, implement that flow in your API runtime and keep user tokens outside Siglume.",
|
|
8581
|
+
"- Do not commit real review keys or external-provider secrets; the generated `.gitignore` excludes local secret files.",
|
|
8822
8582
|
"- Because `runtime_validation.json` is ignored, GitHub samples do not commit review-key values.",
|
|
8823
8583
|
"",
|
|
8824
8584
|
"Suggested workflow:",
|
|
@@ -9036,7 +8796,6 @@ async function runCli(argv, deps = {}) {
|
|
|
9036
8796
|
emit(stdout, `preflight_quality: ${preflight.remote_quality.grade} (${preflight.remote_quality.overall_score}/100)`);
|
|
9037
8797
|
}
|
|
9038
8798
|
if (report.runtime_validation_path) emit(stdout, `runtime_validation_path: ${String(report.runtime_validation_path)}`);
|
|
9039
|
-
if (report.oauth_credentials_path) emit(stdout, `oauth_credentials_path: ${String(report.oauth_credentials_path)}`);
|
|
9040
8799
|
});
|
|
9041
8800
|
program.command("companies").description("List Siglume companies available for company-name publishing.").option("--json", "emit machine-readable JSON", false).action(async (options) => {
|
|
9042
8801
|
const report = await listCompanyPublishersReport(deps);
|
|
@@ -9087,7 +8846,6 @@ async function runCli(argv, deps = {}) {
|
|
|
9087
8846
|
emit(stdout, `listing_id: ${receipt.listing_id}`);
|
|
9088
8847
|
emit(stdout, `receipt_status: ${receipt.status}`);
|
|
9089
8848
|
if (receipt.listing_status) emit(stdout, `listing_status: ${receipt.listing_status}`);
|
|
9090
|
-
if (receipt.oauth_status) emit(stdout, `oauth_configured: ${Boolean(receipt.oauth_status.configured)}`);
|
|
9091
8849
|
if (receipt.review_url) emit(stdout, `review_url: ${receipt.review_url}`);
|
|
9092
8850
|
if (receipt.trace_id) emit(stdout, `trace_id: ${receipt.trace_id}`);
|
|
9093
8851
|
if (receipt.request_id) emit(stdout, `request_id: ${receipt.request_id}`);
|