@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.js
CHANGED
|
@@ -1438,18 +1438,6 @@ function parseBundleMember(data) {
|
|
|
1438
1438
|
link_id: stringOrNull(data.link_id)
|
|
1439
1439
|
};
|
|
1440
1440
|
}
|
|
1441
|
-
function parseConnectedAccountLifecycle(data) {
|
|
1442
|
-
return {
|
|
1443
|
-
connected_account_id: String(data.connected_account_id ?? ""),
|
|
1444
|
-
provider_key: String(data.provider_key ?? ""),
|
|
1445
|
-
expires_at: stringOrNull(data.expires_at),
|
|
1446
|
-
scopes: Array.isArray(data.scopes) ? data.scopes.filter((s) => typeof s === "string") : [],
|
|
1447
|
-
refreshed_at: stringOrNull(data.refreshed_at),
|
|
1448
|
-
connection_status: stringOrNull(data.connection_status),
|
|
1449
|
-
provider_revoked: typeof data.provider_revoked === "boolean" ? data.provider_revoked : null,
|
|
1450
|
-
revoked_at: stringOrNull(data.revoked_at)
|
|
1451
|
-
};
|
|
1452
|
-
}
|
|
1453
1441
|
function parseBundle(data) {
|
|
1454
1442
|
const membersRaw = Array.isArray(data.members) ? data.members : [];
|
|
1455
1443
|
return {
|
|
@@ -1528,21 +1516,6 @@ function parseBinding(data) {
|
|
|
1528
1516
|
raw: { ...data }
|
|
1529
1517
|
};
|
|
1530
1518
|
}
|
|
1531
|
-
function parseConnectedAccount(data) {
|
|
1532
|
-
return {
|
|
1533
|
-
connected_account_id: String(data.connected_account_id ?? data.id ?? ""),
|
|
1534
|
-
provider_key: String(data.provider_key ?? ""),
|
|
1535
|
-
account_role: String(data.account_role ?? ""),
|
|
1536
|
-
display_name: stringOrNull(data.display_name),
|
|
1537
|
-
environment: stringOrNull(data.environment),
|
|
1538
|
-
connection_status: stringOrNull(data.connection_status),
|
|
1539
|
-
scopes: Array.isArray(data.scopes) ? data.scopes.filter((item) => typeof item === "string") : [],
|
|
1540
|
-
metadata: toRecord(data.metadata),
|
|
1541
|
-
created_at: stringOrNull(data.created_at),
|
|
1542
|
-
updated_at: stringOrNull(data.updated_at),
|
|
1543
|
-
raw: { ...data }
|
|
1544
|
-
};
|
|
1545
|
-
}
|
|
1546
1519
|
function parseSupportCase(data) {
|
|
1547
1520
|
return {
|
|
1548
1521
|
support_case_id: String(data.support_case_id ?? data.id ?? ""),
|
|
@@ -2581,13 +2554,6 @@ var init_client = __esm({
|
|
|
2581
2554
|
if (options.runtime_validation) {
|
|
2582
2555
|
payload.runtime_validation = coerceMapping(options.runtime_validation, "runtime_validation");
|
|
2583
2556
|
}
|
|
2584
|
-
if (options.oauth_credentials) {
|
|
2585
|
-
payload.oauth_credentials = Array.isArray(options.oauth_credentials) ? {
|
|
2586
|
-
items: options.oauth_credentials.map(
|
|
2587
|
-
(item, index) => coerceMapping(item, `oauth_credentials[${index}]`)
|
|
2588
|
-
)
|
|
2589
|
-
} : coerceMapping(options.oauth_credentials, "oauth_credentials");
|
|
2590
|
-
}
|
|
2591
2557
|
if (options.source_context) {
|
|
2592
2558
|
payload.source_context = coerceMapping(options.source_context, "source_context");
|
|
2593
2559
|
}
|
|
@@ -2717,7 +2683,6 @@ var init_client = __esm({
|
|
|
2717
2683
|
auto_manifest: toRecord(data.auto_manifest),
|
|
2718
2684
|
confidence: toRecord(data.confidence),
|
|
2719
2685
|
validation_report: toRecord(data.validation_report),
|
|
2720
|
-
oauth_status: toRecord(data.oauth_status),
|
|
2721
2686
|
review_url: stringOrNull(data.review_url),
|
|
2722
2687
|
trace_id: meta.trace_id,
|
|
2723
2688
|
request_id: meta.request_id
|
|
@@ -2893,66 +2858,9 @@ var init_client = __esm({
|
|
|
2893
2858
|
return parseBundle(data);
|
|
2894
2859
|
}
|
|
2895
2860
|
// ----- end bundles -------------------------------------------------------
|
|
2896
|
-
// ----- Connected accounts
|
|
2897
|
-
//
|
|
2898
|
-
|
|
2899
|
-
const body = {
|
|
2900
|
-
listing_id: input.listing_id,
|
|
2901
|
-
redirect_uri: input.redirect_uri
|
|
2902
|
-
};
|
|
2903
|
-
if (input.scopes !== void 0) body.scopes = input.scopes;
|
|
2904
|
-
if (input.account_role !== void 0) body.account_role = input.account_role;
|
|
2905
|
-
const [data] = await this.request("POST", "/me/connected-accounts/oauth/authorize", {
|
|
2906
|
-
json_body: body
|
|
2907
|
-
});
|
|
2908
|
-
return {
|
|
2909
|
-
authorize_url: String(data.authorize_url ?? ""),
|
|
2910
|
-
state: String(data.state ?? ""),
|
|
2911
|
-
provider_key: String(data.provider_key ?? ""),
|
|
2912
|
-
scopes: Array.isArray(data.scopes) ? data.scopes.filter((s) => typeof s === "string") : [],
|
|
2913
|
-
pkce_method: stringOrNull(data.pkce_method)
|
|
2914
|
-
};
|
|
2915
|
-
}
|
|
2916
|
-
async complete_connected_account_oauth(input) {
|
|
2917
|
-
const [data] = await this.request("POST", "/me/connected-accounts/oauth/callback", {
|
|
2918
|
-
json_body: { state: input.state, code: input.code }
|
|
2919
|
-
});
|
|
2920
|
-
return { ...data };
|
|
2921
|
-
}
|
|
2922
|
-
async refresh_connected_account(account_id) {
|
|
2923
|
-
const [data] = await this.request("POST", `/me/connected-accounts/${account_id}/refresh`);
|
|
2924
|
-
return parseConnectedAccountLifecycle(data);
|
|
2925
|
-
}
|
|
2926
|
-
async revoke_connected_account(account_id) {
|
|
2927
|
-
const [data] = await this.request("POST", `/me/connected-accounts/${account_id}/revoke`);
|
|
2928
|
-
return parseConnectedAccountLifecycle(data);
|
|
2929
|
-
}
|
|
2930
|
-
async set_listing_oauth_credentials(listing_id, input) {
|
|
2931
|
-
const body = {
|
|
2932
|
-
provider_key: input.provider_key,
|
|
2933
|
-
client_id: input.client_id,
|
|
2934
|
-
client_secret: input.client_secret,
|
|
2935
|
-
authorize_url: input.authorize_url,
|
|
2936
|
-
token_url: input.token_url
|
|
2937
|
-
};
|
|
2938
|
-
if (input.revoke_url !== void 0) body.revoke_url = input.revoke_url;
|
|
2939
|
-
if (input.display_name !== void 0) body.display_name = input.display_name;
|
|
2940
|
-
if (input.scope_separator !== void 0) body.scope_separator = input.scope_separator;
|
|
2941
|
-
if (input.token_endpoint_auth !== void 0) body.token_endpoint_auth = input.token_endpoint_auth;
|
|
2942
|
-
if (input.pkce_required !== void 0) body.pkce_required = input.pkce_required;
|
|
2943
|
-
if (input.refresh_supported !== void 0) body.refresh_supported = input.refresh_supported;
|
|
2944
|
-
if (input.available_scopes !== void 0) body.available_scopes = input.available_scopes;
|
|
2945
|
-
if (input.required_scopes !== void 0) body.required_scopes = input.required_scopes;
|
|
2946
|
-
const [data] = await this.request("PUT", `/market/capabilities/${listing_id}/oauth-credentials`, {
|
|
2947
|
-
json_body: body
|
|
2948
|
-
});
|
|
2949
|
-
return { ...data };
|
|
2950
|
-
}
|
|
2951
|
-
async get_listing_oauth_credentials_status(listing_id) {
|
|
2952
|
-
const [data] = await this.request("GET", `/market/capabilities/${listing_id}/oauth-credentials`);
|
|
2953
|
-
return { ...data };
|
|
2954
|
-
}
|
|
2955
|
-
// ----- end connected accounts --------------------------------------------
|
|
2861
|
+
// ----- Connected accounts ------------------------------------------------
|
|
2862
|
+
// Architecture B: publisher APIs own external OAuth and token storage.
|
|
2863
|
+
// The SDK no longer exposes platform OAuth or listing credential APIs.
|
|
2956
2864
|
async get_developer_portal() {
|
|
2957
2865
|
const [data, meta] = await this.request("GET", "/market/developer/portal");
|
|
2958
2866
|
return {
|
|
@@ -2985,7 +2893,6 @@ var init_client = __esm({
|
|
|
2985
2893
|
dry_run_supported: Boolean(data.dry_run_supported ?? false),
|
|
2986
2894
|
approval_mode: stringOrNull(data.approval_mode),
|
|
2987
2895
|
required_connected_accounts: Array.isArray(data.required_connected_accounts) ? data.required_connected_accounts : [],
|
|
2988
|
-
connected_accounts: Array.isArray(data.connected_accounts) ? data.connected_accounts.filter((item) => isRecord(item)).map((item) => ({ ...item })) : [],
|
|
2989
2896
|
stub_providers_enabled: Boolean(data.stub_providers_enabled ?? false),
|
|
2990
2897
|
simulated_receipts: Boolean(data.simulated_receipts ?? false),
|
|
2991
2898
|
approval_simulator: Boolean(data.approval_simulator ?? false),
|
|
@@ -4283,25 +4190,6 @@ var init_client = __esm({
|
|
|
4283
4190
|
raw: { ...data }
|
|
4284
4191
|
};
|
|
4285
4192
|
}
|
|
4286
|
-
async list_connected_accounts(options = {}) {
|
|
4287
|
-
const params = {
|
|
4288
|
-
provider_key: options.provider_key,
|
|
4289
|
-
environment: options.environment,
|
|
4290
|
-
limit: Math.max(1, Math.min(Math.trunc(options.limit ?? 50), 100)),
|
|
4291
|
-
cursor: options.cursor
|
|
4292
|
-
};
|
|
4293
|
-
const [data, meta] = await this.request("GET", "/market/connected-accounts", { params });
|
|
4294
|
-
const items = Array.isArray(data.items) ? data.items.filter((item) => isRecord(item)).map(parseConnectedAccount) : [];
|
|
4295
|
-
const next_cursor = stringOrNull(data.next_cursor);
|
|
4296
|
-
return new CursorPageResult({
|
|
4297
|
-
items,
|
|
4298
|
-
next_cursor,
|
|
4299
|
-
limit: typeof data.limit === "number" ? data.limit : params.limit,
|
|
4300
|
-
offset: typeof data.offset === "number" ? data.offset : null,
|
|
4301
|
-
meta,
|
|
4302
|
-
fetchNext: next_cursor ? (cursor) => this.list_connected_accounts({ ...options, cursor }) : void 0
|
|
4303
|
-
});
|
|
4304
|
-
}
|
|
4305
4193
|
async create_support_case(subject, body, options = {}) {
|
|
4306
4194
|
const summary = subject.trim();
|
|
4307
4195
|
const details = body.trim();
|
|
@@ -6145,24 +6033,12 @@ var AppTestHarness = class {
|
|
|
6145
6033
|
this.stubs = stubs;
|
|
6146
6034
|
}
|
|
6147
6035
|
async executeWithKind(execution_kind, task_type = "default", options = {}) {
|
|
6148
|
-
const connected_accounts = options.connected_accounts ?? Object.fromEntries(
|
|
6149
|
-
Object.keys(this.stubs).map((key) => [
|
|
6150
|
-
key,
|
|
6151
|
-
{
|
|
6152
|
-
provider_key: key,
|
|
6153
|
-
session_token: `stub-token-${key}`,
|
|
6154
|
-
environment: Environment.SANDBOX,
|
|
6155
|
-
scopes: []
|
|
6156
|
-
}
|
|
6157
|
-
])
|
|
6158
|
-
);
|
|
6159
6036
|
const ctx = {
|
|
6160
6037
|
agent_id: "test-agent-001",
|
|
6161
6038
|
owner_user_id: "test-owner-001",
|
|
6162
6039
|
task_type,
|
|
6163
6040
|
environment: Environment.SANDBOX,
|
|
6164
6041
|
execution_kind,
|
|
6165
|
-
connected_accounts,
|
|
6166
6042
|
input_params: options.input_params ?? {},
|
|
6167
6043
|
trace_id: options.trace_id,
|
|
6168
6044
|
idempotency_key: options.idempotency_key,
|
|
@@ -6252,12 +6128,6 @@ var AppTestHarness = class {
|
|
|
6252
6128
|
}
|
|
6253
6129
|
return issues;
|
|
6254
6130
|
}
|
|
6255
|
-
async simulate_connected_account_missing(task_type = "default", options = {}) {
|
|
6256
|
-
return this.executeWithKind("dry_run", task_type, {
|
|
6257
|
-
...options,
|
|
6258
|
-
connected_accounts: {}
|
|
6259
|
-
});
|
|
6260
|
-
}
|
|
6261
6131
|
async simulate_metering(record, options = {}) {
|
|
6262
6132
|
const { normalizeUsageRecord: normalizeUsageRecord2 } = await Promise.resolve().then(() => (init_metering(), metering_exports));
|
|
6263
6133
|
const manifest = await this.app.manifest();
|
|
@@ -7220,15 +7090,6 @@ async function loadProject(path = ".") {
|
|
|
7220
7090
|
const tool_manual = tool_manual_path ? JSON.parse(await readFile(tool_manual_path, "utf8")) : buildToolManualTemplate(manifest);
|
|
7221
7091
|
const runtime_validation_path = await findRuntimeValidationPath(root_dir);
|
|
7222
7092
|
const runtime_validation = runtime_validation_path ? await loadJsonObject(runtime_validation_path, "runtime_validation") : void 0;
|
|
7223
|
-
const oauth_credentials_path = await findOauthCredentialsPath(root_dir);
|
|
7224
|
-
let oauth_credentials;
|
|
7225
|
-
if (oauth_credentials_path) {
|
|
7226
|
-
const parsed = JSON.parse(await readFile(oauth_credentials_path, "utf8"));
|
|
7227
|
-
if (!isRecord(parsed) && !Array.isArray(parsed)) {
|
|
7228
|
-
throw new SiglumeProjectError("oauth_credentials must be a JSON object or array");
|
|
7229
|
-
}
|
|
7230
|
-
oauth_credentials = parsed;
|
|
7231
|
-
}
|
|
7232
7093
|
return {
|
|
7233
7094
|
root_dir,
|
|
7234
7095
|
adapter_path,
|
|
@@ -7237,9 +7098,7 @@ async function loadProject(path = ".") {
|
|
|
7237
7098
|
tool_manual_path: tool_manual_path ?? void 0,
|
|
7238
7099
|
tool_manual,
|
|
7239
7100
|
runtime_validation_path: runtime_validation_path ?? void 0,
|
|
7240
|
-
runtime_validation
|
|
7241
|
-
oauth_credentials_path: oauth_credentials_path ?? void 0,
|
|
7242
|
-
oauth_credentials
|
|
7101
|
+
runtime_validation
|
|
7243
7102
|
};
|
|
7244
7103
|
}
|
|
7245
7104
|
function isPlatformManagedRequirement(value) {
|
|
@@ -7277,6 +7136,21 @@ function requiredOauthProviders(requirements) {
|
|
|
7277
7136
|
}
|
|
7278
7137
|
return providers;
|
|
7279
7138
|
}
|
|
7139
|
+
function apiManagedRequirementsMissingConnectUrl(requirements) {
|
|
7140
|
+
const missing = [];
|
|
7141
|
+
for (const item of requirements ?? []) {
|
|
7142
|
+
if (!isRecord(item)) continue;
|
|
7143
|
+
const managedBy = String(item.managed_by ?? "").trim().toLowerCase().replaceAll("_", "-");
|
|
7144
|
+
if (managedBy !== "api") continue;
|
|
7145
|
+
const connectUrl = String(item.connect_url ?? "").trim();
|
|
7146
|
+
if (connectUrl) continue;
|
|
7147
|
+
const label = oauthProviderKeyFromRequirement(item) ?? "(missing provider_key)";
|
|
7148
|
+
if (!missing.includes(label)) {
|
|
7149
|
+
missing.push(label);
|
|
7150
|
+
}
|
|
7151
|
+
}
|
|
7152
|
+
return missing;
|
|
7153
|
+
}
|
|
7280
7154
|
function connectedAccountRequirementLabel(value) {
|
|
7281
7155
|
if (isRecord(value)) {
|
|
7282
7156
|
for (const key of ["provider_key", "provider", "account_type", "name"]) {
|
|
@@ -7287,102 +7161,6 @@ function connectedAccountRequirementLabel(value) {
|
|
|
7287
7161
|
}
|
|
7288
7162
|
return String(value ?? "").trim();
|
|
7289
7163
|
}
|
|
7290
|
-
function oauthProviderRecordsMap(payload) {
|
|
7291
|
-
if (!payload) {
|
|
7292
|
-
return {};
|
|
7293
|
-
}
|
|
7294
|
-
const items = Array.isArray(payload) ? payload : Array.isArray(payload.items) ? payload.items : [payload];
|
|
7295
|
-
const resolved = {};
|
|
7296
|
-
for (const [index, item] of items.entries()) {
|
|
7297
|
-
if (!isRecord(item)) {
|
|
7298
|
-
throw new SiglumeProjectError(`oauth_credentials[${index}] must be a JSON object.`);
|
|
7299
|
-
}
|
|
7300
|
-
const providerKey = oauthProviderKeyFromRequirement(item.provider_key ?? item.provider);
|
|
7301
|
-
if (!providerKey) {
|
|
7302
|
-
throw new SiglumeProjectError(`oauth_credentials[${index}].provider_key is required.`);
|
|
7303
|
-
}
|
|
7304
|
-
const authorizeUrl = String(item.authorize_url ?? item.authorization_url ?? item.auth_url ?? "").trim();
|
|
7305
|
-
const tokenUrl = String(item.token_url ?? "").trim();
|
|
7306
|
-
if (!authorizeUrl || !tokenUrl) {
|
|
7307
|
-
throw new SiglumeProjectError(
|
|
7308
|
-
`oauth_credentials[${index}] must include authorize_url and token_url.`
|
|
7309
|
-
);
|
|
7310
|
-
}
|
|
7311
|
-
for (const [urlKey, urlValue] of Object.entries({
|
|
7312
|
-
authorize_url: authorizeUrl,
|
|
7313
|
-
token_url: tokenUrl,
|
|
7314
|
-
revoke_url: String(item.revoke_url ?? "").trim()
|
|
7315
|
-
})) {
|
|
7316
|
-
if (urlValue && !urlValue.startsWith("https://")) {
|
|
7317
|
-
throw new SiglumeProjectError(`oauth_credentials[${index}].${urlKey} must be an https URL.`);
|
|
7318
|
-
}
|
|
7319
|
-
}
|
|
7320
|
-
const clientId = String(item.client_id ?? "").trim();
|
|
7321
|
-
const clientSecret = String(item.client_secret ?? "").trim();
|
|
7322
|
-
if (!clientId || !clientSecret) {
|
|
7323
|
-
throw new SiglumeProjectError(`oauth_credentials[${index}] must include client_id and client_secret.`);
|
|
7324
|
-
}
|
|
7325
|
-
const rawScopes = item.required_scopes ?? item.scopes;
|
|
7326
|
-
let scopes = [];
|
|
7327
|
-
if (rawScopes == null) {
|
|
7328
|
-
scopes = [];
|
|
7329
|
-
} else if (!Array.isArray(rawScopes)) {
|
|
7330
|
-
throw new SiglumeProjectError(`oauth_credentials[${index}].required_scopes must be a JSON array.`);
|
|
7331
|
-
} else {
|
|
7332
|
-
scopes = rawScopes.map((scope) => String(scope ?? "").trim()).filter(Boolean);
|
|
7333
|
-
}
|
|
7334
|
-
const record = {
|
|
7335
|
-
provider_key: providerKey,
|
|
7336
|
-
client_id: clientId,
|
|
7337
|
-
client_secret: clientSecret,
|
|
7338
|
-
required_scopes: scopes
|
|
7339
|
-
};
|
|
7340
|
-
for (const [key, value] of Object.entries({
|
|
7341
|
-
authorize_url: authorizeUrl,
|
|
7342
|
-
token_url: tokenUrl,
|
|
7343
|
-
revoke_url: String(item.revoke_url ?? "").trim(),
|
|
7344
|
-
display_name: String(item.display_name ?? "").trim(),
|
|
7345
|
-
scope_separator: String(item.scope_separator ?? "").trim(),
|
|
7346
|
-
token_endpoint_auth: String(item.token_endpoint_auth ?? "").trim()
|
|
7347
|
-
})) {
|
|
7348
|
-
if (value) record[key] = value;
|
|
7349
|
-
}
|
|
7350
|
-
for (const key of ["pkce_required", "refresh_supported"]) {
|
|
7351
|
-
if (typeof item[key] === "boolean") record[key] = item[key];
|
|
7352
|
-
}
|
|
7353
|
-
if (Array.isArray(item.available_scopes)) {
|
|
7354
|
-
const availableScopes = item.available_scopes.map((scope) => String(scope ?? "").trim()).filter(Boolean);
|
|
7355
|
-
if (availableScopes.length > 0) record.available_scopes = availableScopes;
|
|
7356
|
-
}
|
|
7357
|
-
resolved[providerKey] = record;
|
|
7358
|
-
}
|
|
7359
|
-
return resolved;
|
|
7360
|
-
}
|
|
7361
|
-
function canonicalOauthCredentialsPayload(payload) {
|
|
7362
|
-
const records = oauthProviderRecordsMap(payload);
|
|
7363
|
-
const providerKeys = Object.keys(records).sort();
|
|
7364
|
-
if (providerKeys.length === 0) {
|
|
7365
|
-
return void 0;
|
|
7366
|
-
}
|
|
7367
|
-
return {
|
|
7368
|
-
items: providerKeys.map((providerKey) => records[providerKey])
|
|
7369
|
-
};
|
|
7370
|
-
}
|
|
7371
|
-
function ensureRequiredOauthCredentials(project) {
|
|
7372
|
-
const requiredProviders = requiredOauthProviders(project.manifest.required_connected_accounts ?? []);
|
|
7373
|
-
if (requiredProviders.length === 0) {
|
|
7374
|
-
return;
|
|
7375
|
-
}
|
|
7376
|
-
const provided = new Set(Object.keys(oauthProviderRecordsMap(project.oauth_credentials)));
|
|
7377
|
-
const missing = requiredProviders.filter((provider) => !provided.has(provider));
|
|
7378
|
-
if (missing.length === 0) {
|
|
7379
|
-
return;
|
|
7380
|
-
}
|
|
7381
|
-
const path = project.oauth_credentials_path ?? join(project.root_dir, "oauth_credentials.json");
|
|
7382
|
-
throw new SiglumeProjectError(
|
|
7383
|
-
`${path} is required for platform-managed OAuth APIs. Missing provider seeds: ${missing.join(", ")}`
|
|
7384
|
-
);
|
|
7385
|
-
}
|
|
7386
7164
|
async function validateProject(path = ".", deps = {}) {
|
|
7387
7165
|
const project = await loadProject(path);
|
|
7388
7166
|
const manifest_issues = await projectValidationIssues(project);
|
|
@@ -7537,10 +7315,21 @@ function ensureExplicitToolManual(project) {
|
|
|
7537
7315
|
async function registrationPreflight(project, client) {
|
|
7538
7316
|
const manifestIssues = await projectValidationIssues(project);
|
|
7539
7317
|
const [toolManualValid, toolManualIssues] = validate_tool_manual(project.tool_manual);
|
|
7318
|
+
const retiredPlatformOauthProviders = requiredOauthProviders(project.manifest.required_connected_accounts ?? []);
|
|
7319
|
+
if (retiredPlatformOauthProviders.length > 0) {
|
|
7320
|
+
throw new SiglumeProjectError(
|
|
7321
|
+
`Registration preflight failed. Fix these before calling auto-register:
|
|
7322
|
+
- platform-managed OAuth is retired. Use managed_by="api" with connect_url: ${retiredPlatformOauthProviders.join(", ")}`
|
|
7323
|
+
);
|
|
7324
|
+
}
|
|
7325
|
+
const apiManagedMissingConnectUrl = apiManagedRequirementsMissingConnectUrl(project.manifest.required_connected_accounts ?? []);
|
|
7326
|
+
if (apiManagedMissingConnectUrl.length > 0) {
|
|
7327
|
+
throw new SiglumeProjectError(
|
|
7328
|
+
`Registration preflight failed. Fix these before calling auto-register:
|
|
7329
|
+
- API-managed OAuth requirements must include connect_url: ${apiManagedMissingConnectUrl.join(", ")}`
|
|
7330
|
+
);
|
|
7331
|
+
}
|
|
7540
7332
|
const remoteQuality = await client.preview_quality_score(project.tool_manual);
|
|
7541
|
-
const requiredOauthProvidersList = requiredOauthProviders(project.manifest.required_connected_accounts ?? []);
|
|
7542
|
-
const oauthProviderRecords = oauthProviderRecordsMap(project.oauth_credentials);
|
|
7543
|
-
const missingOauthProviders = requiredOauthProvidersList.filter((provider) => !oauthProviderRecords[provider]);
|
|
7544
7333
|
const blockingToolManualIssues = toolManualIssues.filter((issue2) => issue2.severity === "error");
|
|
7545
7334
|
const errors = [
|
|
7546
7335
|
...manifestIssues.map((issue2) => String(issue2)),
|
|
@@ -7552,17 +7341,12 @@ async function registrationPreflight(project, client) {
|
|
|
7552
7341
|
if (!remoteQualityOk(remoteQuality)) {
|
|
7553
7342
|
errors.push(`remote Tool Manual quality is not publishable: ${remoteQuality.grade} (${remoteQuality.overall_score}/100)`);
|
|
7554
7343
|
}
|
|
7555
|
-
if (missingOauthProviders.length > 0) {
|
|
7556
|
-
errors.push(`oauth_credentials.json is required for platform-managed OAuth APIs: ${missingOauthProviders.join(", ")}`);
|
|
7557
|
-
}
|
|
7558
7344
|
const preflight = {
|
|
7559
7345
|
manifest_issues: manifestIssues,
|
|
7560
7346
|
tool_manual_valid: toolManualValid,
|
|
7561
7347
|
tool_manual_issues: toolManualIssues.map((issue2) => toJsonable(issue2)),
|
|
7562
7348
|
remote_quality: toJsonable(remoteQuality),
|
|
7563
|
-
|
|
7564
|
-
oauth_credentials_path: project.oauth_credentials_path ?? null,
|
|
7565
|
-
oauth_missing_providers: missingOauthProviders,
|
|
7349
|
+
retired_platform_oauth_providers: retiredPlatformOauthProviders,
|
|
7566
7350
|
ok: errors.length === 0
|
|
7567
7351
|
};
|
|
7568
7352
|
if (errors.length > 0) {
|
|
@@ -7601,8 +7385,6 @@ async function runRegistration(path = ".", options = {}, deps = {}) {
|
|
|
7601
7385
|
ensureExplicitToolManual(project);
|
|
7602
7386
|
ensureManifestPublisherIdentity(project);
|
|
7603
7387
|
ensureRuntimeValidationReady(project);
|
|
7604
|
-
ensureRequiredOauthCredentials(project);
|
|
7605
|
-
const canonicalOauthCredentials = canonicalOauthCredentialsPayload(project.oauth_credentials);
|
|
7606
7388
|
const client = await createClient(deps);
|
|
7607
7389
|
if (requestedCompanySlug) {
|
|
7608
7390
|
const slug = companyNameSlug(requestedCompanySlug);
|
|
@@ -7679,14 +7461,12 @@ async function runRegistration(path = ".", options = {}, deps = {}) {
|
|
|
7679
7461
|
}
|
|
7680
7462
|
}
|
|
7681
7463
|
const receipt = await client.auto_register(project.manifest, project.tool_manual, {
|
|
7682
|
-
runtime_validation: project.runtime_validation
|
|
7683
|
-
oauth_credentials: canonicalOauthCredentials
|
|
7464
|
+
runtime_validation: project.runtime_validation
|
|
7684
7465
|
});
|
|
7685
7466
|
const result = {
|
|
7686
7467
|
receipt: toJsonable(receipt),
|
|
7687
7468
|
registration_preflight: preflight,
|
|
7688
|
-
runtime_validation_path: project.runtime_validation_path ?? null
|
|
7689
|
-
oauth_credentials_path: project.oauth_credentials_path ?? null
|
|
7469
|
+
runtime_validation_path: project.runtime_validation_path ?? null
|
|
7690
7470
|
};
|
|
7691
7471
|
if (developerPortalPreflight) {
|
|
7692
7472
|
result.developer_portal_preflight = developerPortalPreflight;
|
|
@@ -7707,7 +7487,6 @@ async function runPreflight(path = ".", deps = {}) {
|
|
|
7707
7487
|
ensureExplicitToolManual(project);
|
|
7708
7488
|
ensureManifestPublisherIdentity(project);
|
|
7709
7489
|
ensureRuntimeValidationReady(project);
|
|
7710
|
-
ensureRequiredOauthCredentials(project);
|
|
7711
7490
|
const client = await createClient(deps);
|
|
7712
7491
|
const preflight = await registrationPreflight(project, client);
|
|
7713
7492
|
let developerPortalPreflight = null;
|
|
@@ -7725,8 +7504,7 @@ async function runPreflight(path = ".", deps = {}) {
|
|
|
7725
7504
|
ok: true,
|
|
7726
7505
|
adapter_path: project.adapter_path,
|
|
7727
7506
|
registration_preflight: preflight,
|
|
7728
|
-
runtime_validation_path: project.runtime_validation_path ?? null
|
|
7729
|
-
oauth_credentials_path: project.oauth_credentials_path ?? null
|
|
7507
|
+
runtime_validation_path: project.runtime_validation_path ?? null
|
|
7730
7508
|
};
|
|
7731
7509
|
if (developerPortalPreflight) {
|
|
7732
7510
|
result.developer_portal_preflight = developerPortalPreflight;
|
|
@@ -8208,7 +7986,7 @@ function operationReadmeTemplate(operation, manifest, warning) {
|
|
|
8208
7986
|
"- `tool_manual.json`: machine-generated ToolManual scaffold",
|
|
8209
7987
|
"- `runtime_validation.json`: local public endpoint and review-key checks used by auto-register",
|
|
8210
7988
|
"- `docs/api-usage.md`: publishable API usage guide template for `docs_url`",
|
|
8211
|
-
"- `.gitignore`: keeps runtime review keys
|
|
7989
|
+
"- `.gitignore`: keeps runtime review keys out of Git",
|
|
8212
7990
|
"- `tests/test_adapter.ts`: smoke test for `AppTestHarness`",
|
|
8213
7991
|
"",
|
|
8214
7992
|
"Before registering, replace all generated placeholders:",
|
|
@@ -8216,8 +7994,8 @@ function operationReadmeTemplate(operation, manifest, warning) {
|
|
|
8216
7994
|
"- Replace `support_contact` with a real support email address or public support URL.",
|
|
8217
7995
|
"- Optional `seller_homepage_url` is the seller's official site and can stay blank.",
|
|
8218
7996
|
"- In the local `runtime_validation.json`, replace the public URL and review-key placeholders.",
|
|
8219
|
-
"- If the API uses
|
|
8220
|
-
"- Do not commit real review keys or
|
|
7997
|
+
"- If the API uses external OAuth, implement that flow in your API runtime and keep user tokens outside Siglume.",
|
|
7998
|
+
"- Do not commit real review keys or external-provider secrets; the generated `.gitignore` excludes local secret files.",
|
|
8221
7999
|
"- Because `runtime_validation.json` is ignored, GitHub samples do not commit review-key values.",
|
|
8222
8000
|
"",
|
|
8223
8001
|
"## Commands",
|
|
@@ -8293,8 +8071,6 @@ function generatedGitignore() {
|
|
|
8293
8071
|
"!.env.example",
|
|
8294
8072
|
"runtime_validation.json",
|
|
8295
8073
|
"runtime-validation.json",
|
|
8296
|
-
"oauth_credentials.json",
|
|
8297
|
-
"oauth-credentials.json",
|
|
8298
8074
|
"",
|
|
8299
8075
|
"# Python / test artifacts.",
|
|
8300
8076
|
"__pycache__/",
|
|
@@ -8440,13 +8216,6 @@ async function runHarnessForProject(project) {
|
|
|
8440
8216
|
checks.push(executionCheck("quote", await harness.execute_quote(task_type, { input_params: sample_input }), harness));
|
|
8441
8217
|
checks.push(executionCheck("payment", await harness.execute_payment(task_type, { input_params: sample_input }), harness));
|
|
8442
8218
|
}
|
|
8443
|
-
checks.push(
|
|
8444
|
-
executionCheck(
|
|
8445
|
-
"missing_account_simulation",
|
|
8446
|
-
await harness.simulate_connected_account_missing(task_type, { input_params: sample_input }),
|
|
8447
|
-
harness
|
|
8448
|
-
)
|
|
8449
|
-
);
|
|
8450
8219
|
return {
|
|
8451
8220
|
adapter_path: project.adapter_path,
|
|
8452
8221
|
task_type,
|
|
@@ -8549,15 +8318,6 @@ async function findRuntimeValidationPath(root_dir) {
|
|
|
8549
8318
|
}
|
|
8550
8319
|
return null;
|
|
8551
8320
|
}
|
|
8552
|
-
async function findOauthCredentialsPath(root_dir) {
|
|
8553
|
-
for (const name of ["oauth_credentials.json", "oauth-credentials.json"]) {
|
|
8554
|
-
const candidate = join(root_dir, name);
|
|
8555
|
-
if (existsSync(candidate)) {
|
|
8556
|
-
return candidate;
|
|
8557
|
-
}
|
|
8558
|
-
}
|
|
8559
|
-
return null;
|
|
8560
|
-
}
|
|
8561
8321
|
async function loadJsonObject(path, label) {
|
|
8562
8322
|
let payload;
|
|
8563
8323
|
try {
|
|
@@ -8789,15 +8549,15 @@ function readmeTemplate(template) {
|
|
|
8789
8549
|
"- `tool_manual.json`: editable ToolManual draft for validation and registration",
|
|
8790
8550
|
"- `runtime_validation.json`: local live API smoke-test contract used during registration",
|
|
8791
8551
|
"- `docs/api-usage.md`: publish this page and use its public URL as `docs_url`",
|
|
8792
|
-
"- `.gitignore`: keeps runtime review keys
|
|
8552
|
+
"- `.gitignore`: keeps runtime review keys out of Git",
|
|
8793
8553
|
"",
|
|
8794
8554
|
"Before registering, replace all generated placeholders:",
|
|
8795
8555
|
"- In `adapter.ts` and `manifest.json`, replace `docs_url` with a dedicated public API usage guide, not a homepage.",
|
|
8796
8556
|
"- Replace `support_contact` with a real support email address or public support URL.",
|
|
8797
8557
|
"- Optional `seller_homepage_url` is the seller's official site and can stay blank.",
|
|
8798
8558
|
"- In the local `runtime_validation.json`, replace the public URL and review-key placeholders.",
|
|
8799
|
-
"- If the API uses
|
|
8800
|
-
"- Do not commit real review keys or
|
|
8559
|
+
"- If the API uses external OAuth, implement that flow in your API runtime and keep user tokens outside Siglume.",
|
|
8560
|
+
"- Do not commit real review keys or external-provider secrets; the generated `.gitignore` excludes local secret files.",
|
|
8801
8561
|
"- Because `runtime_validation.json` is ignored, GitHub samples do not commit review-key values.",
|
|
8802
8562
|
"",
|
|
8803
8563
|
"Suggested workflow:",
|
|
@@ -9015,7 +8775,6 @@ async function runCli(argv, deps = {}) {
|
|
|
9015
8775
|
emit(stdout, `preflight_quality: ${preflight.remote_quality.grade} (${preflight.remote_quality.overall_score}/100)`);
|
|
9016
8776
|
}
|
|
9017
8777
|
if (report.runtime_validation_path) emit(stdout, `runtime_validation_path: ${String(report.runtime_validation_path)}`);
|
|
9018
|
-
if (report.oauth_credentials_path) emit(stdout, `oauth_credentials_path: ${String(report.oauth_credentials_path)}`);
|
|
9019
8778
|
});
|
|
9020
8779
|
program.command("companies").description("List Siglume companies available for company-name publishing.").option("--json", "emit machine-readable JSON", false).action(async (options) => {
|
|
9021
8780
|
const report = await listCompanyPublishersReport(deps);
|
|
@@ -9066,7 +8825,6 @@ async function runCli(argv, deps = {}) {
|
|
|
9066
8825
|
emit(stdout, `listing_id: ${receipt.listing_id}`);
|
|
9067
8826
|
emit(stdout, `receipt_status: ${receipt.status}`);
|
|
9068
8827
|
if (receipt.listing_status) emit(stdout, `listing_status: ${receipt.listing_status}`);
|
|
9069
|
-
if (receipt.oauth_status) emit(stdout, `oauth_configured: ${Boolean(receipt.oauth_status.configured)}`);
|
|
9070
8828
|
if (receipt.review_url) emit(stdout, `review_url: ${receipt.review_url}`);
|
|
9071
8829
|
if (receipt.trace_id) emit(stdout, `trace_id: ${receipt.trace_id}`);
|
|
9072
8830
|
if (receipt.request_id) emit(stdout, `request_id: ${receipt.request_id}`);
|