@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/cli/index.cjs
CHANGED
|
@@ -1460,18 +1460,6 @@ function parseBundleMember(data) {
|
|
|
1460
1460
|
link_id: stringOrNull(data.link_id)
|
|
1461
1461
|
};
|
|
1462
1462
|
}
|
|
1463
|
-
function parseConnectedAccountLifecycle(data) {
|
|
1464
|
-
return {
|
|
1465
|
-
connected_account_id: String(data.connected_account_id ?? ""),
|
|
1466
|
-
provider_key: String(data.provider_key ?? ""),
|
|
1467
|
-
expires_at: stringOrNull(data.expires_at),
|
|
1468
|
-
scopes: Array.isArray(data.scopes) ? data.scopes.filter((s) => typeof s === "string") : [],
|
|
1469
|
-
refreshed_at: stringOrNull(data.refreshed_at),
|
|
1470
|
-
connection_status: stringOrNull(data.connection_status),
|
|
1471
|
-
provider_revoked: typeof data.provider_revoked === "boolean" ? data.provider_revoked : null,
|
|
1472
|
-
revoked_at: stringOrNull(data.revoked_at)
|
|
1473
|
-
};
|
|
1474
|
-
}
|
|
1475
1463
|
function parseBundle(data) {
|
|
1476
1464
|
const membersRaw = Array.isArray(data.members) ? data.members : [];
|
|
1477
1465
|
return {
|
|
@@ -1550,21 +1538,6 @@ function parseBinding(data) {
|
|
|
1550
1538
|
raw: { ...data }
|
|
1551
1539
|
};
|
|
1552
1540
|
}
|
|
1553
|
-
function parseConnectedAccount(data) {
|
|
1554
|
-
return {
|
|
1555
|
-
connected_account_id: String(data.connected_account_id ?? data.id ?? ""),
|
|
1556
|
-
provider_key: String(data.provider_key ?? ""),
|
|
1557
|
-
account_role: String(data.account_role ?? ""),
|
|
1558
|
-
display_name: stringOrNull(data.display_name),
|
|
1559
|
-
environment: stringOrNull(data.environment),
|
|
1560
|
-
connection_status: stringOrNull(data.connection_status),
|
|
1561
|
-
scopes: Array.isArray(data.scopes) ? data.scopes.filter((item) => typeof item === "string") : [],
|
|
1562
|
-
metadata: toRecord(data.metadata),
|
|
1563
|
-
created_at: stringOrNull(data.created_at),
|
|
1564
|
-
updated_at: stringOrNull(data.updated_at),
|
|
1565
|
-
raw: { ...data }
|
|
1566
|
-
};
|
|
1567
|
-
}
|
|
1568
1541
|
function parseSupportCase(data) {
|
|
1569
1542
|
return {
|
|
1570
1543
|
support_case_id: String(data.support_case_id ?? data.id ?? ""),
|
|
@@ -2603,13 +2576,6 @@ var init_client = __esm({
|
|
|
2603
2576
|
if (options.runtime_validation) {
|
|
2604
2577
|
payload.runtime_validation = coerceMapping(options.runtime_validation, "runtime_validation");
|
|
2605
2578
|
}
|
|
2606
|
-
if (options.oauth_credentials) {
|
|
2607
|
-
payload.oauth_credentials = Array.isArray(options.oauth_credentials) ? {
|
|
2608
|
-
items: options.oauth_credentials.map(
|
|
2609
|
-
(item, index) => coerceMapping(item, `oauth_credentials[${index}]`)
|
|
2610
|
-
)
|
|
2611
|
-
} : coerceMapping(options.oauth_credentials, "oauth_credentials");
|
|
2612
|
-
}
|
|
2613
2579
|
if (options.source_context) {
|
|
2614
2580
|
payload.source_context = coerceMapping(options.source_context, "source_context");
|
|
2615
2581
|
}
|
|
@@ -2739,7 +2705,6 @@ var init_client = __esm({
|
|
|
2739
2705
|
auto_manifest: toRecord(data.auto_manifest),
|
|
2740
2706
|
confidence: toRecord(data.confidence),
|
|
2741
2707
|
validation_report: toRecord(data.validation_report),
|
|
2742
|
-
oauth_status: toRecord(data.oauth_status),
|
|
2743
2708
|
review_url: stringOrNull(data.review_url),
|
|
2744
2709
|
trace_id: meta.trace_id,
|
|
2745
2710
|
request_id: meta.request_id
|
|
@@ -2915,66 +2880,9 @@ var init_client = __esm({
|
|
|
2915
2880
|
return parseBundle(data);
|
|
2916
2881
|
}
|
|
2917
2882
|
// ----- end bundles -------------------------------------------------------
|
|
2918
|
-
// ----- Connected accounts
|
|
2919
|
-
//
|
|
2920
|
-
|
|
2921
|
-
const body = {
|
|
2922
|
-
listing_id: input.listing_id,
|
|
2923
|
-
redirect_uri: input.redirect_uri
|
|
2924
|
-
};
|
|
2925
|
-
if (input.scopes !== void 0) body.scopes = input.scopes;
|
|
2926
|
-
if (input.account_role !== void 0) body.account_role = input.account_role;
|
|
2927
|
-
const [data] = await this.request("POST", "/me/connected-accounts/oauth/authorize", {
|
|
2928
|
-
json_body: body
|
|
2929
|
-
});
|
|
2930
|
-
return {
|
|
2931
|
-
authorize_url: String(data.authorize_url ?? ""),
|
|
2932
|
-
state: String(data.state ?? ""),
|
|
2933
|
-
provider_key: String(data.provider_key ?? ""),
|
|
2934
|
-
scopes: Array.isArray(data.scopes) ? data.scopes.filter((s) => typeof s === "string") : [],
|
|
2935
|
-
pkce_method: stringOrNull(data.pkce_method)
|
|
2936
|
-
};
|
|
2937
|
-
}
|
|
2938
|
-
async complete_connected_account_oauth(input) {
|
|
2939
|
-
const [data] = await this.request("POST", "/me/connected-accounts/oauth/callback", {
|
|
2940
|
-
json_body: { state: input.state, code: input.code }
|
|
2941
|
-
});
|
|
2942
|
-
return { ...data };
|
|
2943
|
-
}
|
|
2944
|
-
async refresh_connected_account(account_id) {
|
|
2945
|
-
const [data] = await this.request("POST", `/me/connected-accounts/${account_id}/refresh`);
|
|
2946
|
-
return parseConnectedAccountLifecycle(data);
|
|
2947
|
-
}
|
|
2948
|
-
async revoke_connected_account(account_id) {
|
|
2949
|
-
const [data] = await this.request("POST", `/me/connected-accounts/${account_id}/revoke`);
|
|
2950
|
-
return parseConnectedAccountLifecycle(data);
|
|
2951
|
-
}
|
|
2952
|
-
async set_listing_oauth_credentials(listing_id, input) {
|
|
2953
|
-
const body = {
|
|
2954
|
-
provider_key: input.provider_key,
|
|
2955
|
-
client_id: input.client_id,
|
|
2956
|
-
client_secret: input.client_secret,
|
|
2957
|
-
authorize_url: input.authorize_url,
|
|
2958
|
-
token_url: input.token_url
|
|
2959
|
-
};
|
|
2960
|
-
if (input.revoke_url !== void 0) body.revoke_url = input.revoke_url;
|
|
2961
|
-
if (input.display_name !== void 0) body.display_name = input.display_name;
|
|
2962
|
-
if (input.scope_separator !== void 0) body.scope_separator = input.scope_separator;
|
|
2963
|
-
if (input.token_endpoint_auth !== void 0) body.token_endpoint_auth = input.token_endpoint_auth;
|
|
2964
|
-
if (input.pkce_required !== void 0) body.pkce_required = input.pkce_required;
|
|
2965
|
-
if (input.refresh_supported !== void 0) body.refresh_supported = input.refresh_supported;
|
|
2966
|
-
if (input.available_scopes !== void 0) body.available_scopes = input.available_scopes;
|
|
2967
|
-
if (input.required_scopes !== void 0) body.required_scopes = input.required_scopes;
|
|
2968
|
-
const [data] = await this.request("PUT", `/market/capabilities/${listing_id}/oauth-credentials`, {
|
|
2969
|
-
json_body: body
|
|
2970
|
-
});
|
|
2971
|
-
return { ...data };
|
|
2972
|
-
}
|
|
2973
|
-
async get_listing_oauth_credentials_status(listing_id) {
|
|
2974
|
-
const [data] = await this.request("GET", `/market/capabilities/${listing_id}/oauth-credentials`);
|
|
2975
|
-
return { ...data };
|
|
2976
|
-
}
|
|
2977
|
-
// ----- end connected accounts --------------------------------------------
|
|
2883
|
+
// ----- Connected accounts ------------------------------------------------
|
|
2884
|
+
// Architecture B: publisher APIs own external OAuth and token storage.
|
|
2885
|
+
// The SDK no longer exposes platform OAuth or listing credential APIs.
|
|
2978
2886
|
async get_developer_portal() {
|
|
2979
2887
|
const [data, meta] = await this.request("GET", "/market/developer/portal");
|
|
2980
2888
|
return {
|
|
@@ -3007,7 +2915,6 @@ var init_client = __esm({
|
|
|
3007
2915
|
dry_run_supported: Boolean(data.dry_run_supported ?? false),
|
|
3008
2916
|
approval_mode: stringOrNull(data.approval_mode),
|
|
3009
2917
|
required_connected_accounts: Array.isArray(data.required_connected_accounts) ? data.required_connected_accounts : [],
|
|
3010
|
-
connected_accounts: Array.isArray(data.connected_accounts) ? data.connected_accounts.filter((item) => isRecord(item)).map((item) => ({ ...item })) : [],
|
|
3011
2918
|
stub_providers_enabled: Boolean(data.stub_providers_enabled ?? false),
|
|
3012
2919
|
simulated_receipts: Boolean(data.simulated_receipts ?? false),
|
|
3013
2920
|
approval_simulator: Boolean(data.approval_simulator ?? false),
|
|
@@ -4305,25 +4212,6 @@ var init_client = __esm({
|
|
|
4305
4212
|
raw: { ...data }
|
|
4306
4213
|
};
|
|
4307
4214
|
}
|
|
4308
|
-
async list_connected_accounts(options = {}) {
|
|
4309
|
-
const params = {
|
|
4310
|
-
provider_key: options.provider_key,
|
|
4311
|
-
environment: options.environment,
|
|
4312
|
-
limit: Math.max(1, Math.min(Math.trunc(options.limit ?? 50), 100)),
|
|
4313
|
-
cursor: options.cursor
|
|
4314
|
-
};
|
|
4315
|
-
const [data, meta] = await this.request("GET", "/market/connected-accounts", { params });
|
|
4316
|
-
const items = Array.isArray(data.items) ? data.items.filter((item) => isRecord(item)).map(parseConnectedAccount) : [];
|
|
4317
|
-
const next_cursor = stringOrNull(data.next_cursor);
|
|
4318
|
-
return new CursorPageResult({
|
|
4319
|
-
items,
|
|
4320
|
-
next_cursor,
|
|
4321
|
-
limit: typeof data.limit === "number" ? data.limit : params.limit,
|
|
4322
|
-
offset: typeof data.offset === "number" ? data.offset : null,
|
|
4323
|
-
meta,
|
|
4324
|
-
fetchNext: next_cursor ? (cursor) => this.list_connected_accounts({ ...options, cursor }) : void 0
|
|
4325
|
-
});
|
|
4326
|
-
}
|
|
4327
4215
|
async create_support_case(subject, body, options = {}) {
|
|
4328
4216
|
const summary = subject.trim();
|
|
4329
4217
|
const details = body.trim();
|
|
@@ -6172,24 +6060,12 @@ var AppTestHarness = class {
|
|
|
6172
6060
|
this.stubs = stubs;
|
|
6173
6061
|
}
|
|
6174
6062
|
async executeWithKind(execution_kind, task_type = "default", options = {}) {
|
|
6175
|
-
const connected_accounts = options.connected_accounts ?? Object.fromEntries(
|
|
6176
|
-
Object.keys(this.stubs).map((key) => [
|
|
6177
|
-
key,
|
|
6178
|
-
{
|
|
6179
|
-
provider_key: key,
|
|
6180
|
-
session_token: `stub-token-${key}`,
|
|
6181
|
-
environment: Environment.SANDBOX,
|
|
6182
|
-
scopes: []
|
|
6183
|
-
}
|
|
6184
|
-
])
|
|
6185
|
-
);
|
|
6186
6063
|
const ctx = {
|
|
6187
6064
|
agent_id: "test-agent-001",
|
|
6188
6065
|
owner_user_id: "test-owner-001",
|
|
6189
6066
|
task_type,
|
|
6190
6067
|
environment: Environment.SANDBOX,
|
|
6191
6068
|
execution_kind,
|
|
6192
|
-
connected_accounts,
|
|
6193
6069
|
input_params: options.input_params ?? {},
|
|
6194
6070
|
trace_id: options.trace_id,
|
|
6195
6071
|
idempotency_key: options.idempotency_key,
|
|
@@ -6279,12 +6155,6 @@ var AppTestHarness = class {
|
|
|
6279
6155
|
}
|
|
6280
6156
|
return issues;
|
|
6281
6157
|
}
|
|
6282
|
-
async simulate_connected_account_missing(task_type = "default", options = {}) {
|
|
6283
|
-
return this.executeWithKind("dry_run", task_type, {
|
|
6284
|
-
...options,
|
|
6285
|
-
connected_accounts: {}
|
|
6286
|
-
});
|
|
6287
|
-
}
|
|
6288
6158
|
async simulate_metering(record, options = {}) {
|
|
6289
6159
|
const { normalizeUsageRecord: normalizeUsageRecord2 } = await Promise.resolve().then(() => (init_metering(), metering_exports));
|
|
6290
6160
|
const manifest = await this.app.manifest();
|
|
@@ -7247,15 +7117,6 @@ async function loadProject(path = ".") {
|
|
|
7247
7117
|
const tool_manual = tool_manual_path ? JSON.parse(await (0, import_promises.readFile)(tool_manual_path, "utf8")) : buildToolManualTemplate(manifest);
|
|
7248
7118
|
const runtime_validation_path = await findRuntimeValidationPath(root_dir);
|
|
7249
7119
|
const runtime_validation = runtime_validation_path ? await loadJsonObject(runtime_validation_path, "runtime_validation") : void 0;
|
|
7250
|
-
const oauth_credentials_path = await findOauthCredentialsPath(root_dir);
|
|
7251
|
-
let oauth_credentials;
|
|
7252
|
-
if (oauth_credentials_path) {
|
|
7253
|
-
const parsed = JSON.parse(await (0, import_promises.readFile)(oauth_credentials_path, "utf8"));
|
|
7254
|
-
if (!isRecord(parsed) && !Array.isArray(parsed)) {
|
|
7255
|
-
throw new SiglumeProjectError("oauth_credentials must be a JSON object or array");
|
|
7256
|
-
}
|
|
7257
|
-
oauth_credentials = parsed;
|
|
7258
|
-
}
|
|
7259
7120
|
return {
|
|
7260
7121
|
root_dir,
|
|
7261
7122
|
adapter_path,
|
|
@@ -7264,9 +7125,7 @@ async function loadProject(path = ".") {
|
|
|
7264
7125
|
tool_manual_path: tool_manual_path ?? void 0,
|
|
7265
7126
|
tool_manual,
|
|
7266
7127
|
runtime_validation_path: runtime_validation_path ?? void 0,
|
|
7267
|
-
runtime_validation
|
|
7268
|
-
oauth_credentials_path: oauth_credentials_path ?? void 0,
|
|
7269
|
-
oauth_credentials
|
|
7128
|
+
runtime_validation
|
|
7270
7129
|
};
|
|
7271
7130
|
}
|
|
7272
7131
|
function isPlatformManagedRequirement(value) {
|
|
@@ -7304,6 +7163,21 @@ function requiredOauthProviders(requirements) {
|
|
|
7304
7163
|
}
|
|
7305
7164
|
return providers;
|
|
7306
7165
|
}
|
|
7166
|
+
function apiManagedRequirementsMissingConnectUrl(requirements) {
|
|
7167
|
+
const missing = [];
|
|
7168
|
+
for (const item of requirements ?? []) {
|
|
7169
|
+
if (!isRecord(item)) continue;
|
|
7170
|
+
const managedBy = String(item.managed_by ?? "").trim().toLowerCase().replaceAll("_", "-");
|
|
7171
|
+
if (managedBy !== "api") continue;
|
|
7172
|
+
const connectUrl = String(item.connect_url ?? "").trim();
|
|
7173
|
+
if (connectUrl) continue;
|
|
7174
|
+
const label = oauthProviderKeyFromRequirement(item) ?? "(missing provider_key)";
|
|
7175
|
+
if (!missing.includes(label)) {
|
|
7176
|
+
missing.push(label);
|
|
7177
|
+
}
|
|
7178
|
+
}
|
|
7179
|
+
return missing;
|
|
7180
|
+
}
|
|
7307
7181
|
function connectedAccountRequirementLabel(value) {
|
|
7308
7182
|
if (isRecord(value)) {
|
|
7309
7183
|
for (const key of ["provider_key", "provider", "account_type", "name"]) {
|
|
@@ -7314,102 +7188,6 @@ function connectedAccountRequirementLabel(value) {
|
|
|
7314
7188
|
}
|
|
7315
7189
|
return String(value ?? "").trim();
|
|
7316
7190
|
}
|
|
7317
|
-
function oauthProviderRecordsMap(payload) {
|
|
7318
|
-
if (!payload) {
|
|
7319
|
-
return {};
|
|
7320
|
-
}
|
|
7321
|
-
const items = Array.isArray(payload) ? payload : Array.isArray(payload.items) ? payload.items : [payload];
|
|
7322
|
-
const resolved = {};
|
|
7323
|
-
for (const [index, item] of items.entries()) {
|
|
7324
|
-
if (!isRecord(item)) {
|
|
7325
|
-
throw new SiglumeProjectError(`oauth_credentials[${index}] must be a JSON object.`);
|
|
7326
|
-
}
|
|
7327
|
-
const providerKey = oauthProviderKeyFromRequirement(item.provider_key ?? item.provider);
|
|
7328
|
-
if (!providerKey) {
|
|
7329
|
-
throw new SiglumeProjectError(`oauth_credentials[${index}].provider_key is required.`);
|
|
7330
|
-
}
|
|
7331
|
-
const authorizeUrl = String(item.authorize_url ?? item.authorization_url ?? item.auth_url ?? "").trim();
|
|
7332
|
-
const tokenUrl = String(item.token_url ?? "").trim();
|
|
7333
|
-
if (!authorizeUrl || !tokenUrl) {
|
|
7334
|
-
throw new SiglumeProjectError(
|
|
7335
|
-
`oauth_credentials[${index}] must include authorize_url and token_url.`
|
|
7336
|
-
);
|
|
7337
|
-
}
|
|
7338
|
-
for (const [urlKey, urlValue] of Object.entries({
|
|
7339
|
-
authorize_url: authorizeUrl,
|
|
7340
|
-
token_url: tokenUrl,
|
|
7341
|
-
revoke_url: String(item.revoke_url ?? "").trim()
|
|
7342
|
-
})) {
|
|
7343
|
-
if (urlValue && !urlValue.startsWith("https://")) {
|
|
7344
|
-
throw new SiglumeProjectError(`oauth_credentials[${index}].${urlKey} must be an https URL.`);
|
|
7345
|
-
}
|
|
7346
|
-
}
|
|
7347
|
-
const clientId = String(item.client_id ?? "").trim();
|
|
7348
|
-
const clientSecret = String(item.client_secret ?? "").trim();
|
|
7349
|
-
if (!clientId || !clientSecret) {
|
|
7350
|
-
throw new SiglumeProjectError(`oauth_credentials[${index}] must include client_id and client_secret.`);
|
|
7351
|
-
}
|
|
7352
|
-
const rawScopes = item.required_scopes ?? item.scopes;
|
|
7353
|
-
let scopes = [];
|
|
7354
|
-
if (rawScopes == null) {
|
|
7355
|
-
scopes = [];
|
|
7356
|
-
} else if (!Array.isArray(rawScopes)) {
|
|
7357
|
-
throw new SiglumeProjectError(`oauth_credentials[${index}].required_scopes must be a JSON array.`);
|
|
7358
|
-
} else {
|
|
7359
|
-
scopes = rawScopes.map((scope) => String(scope ?? "").trim()).filter(Boolean);
|
|
7360
|
-
}
|
|
7361
|
-
const record = {
|
|
7362
|
-
provider_key: providerKey,
|
|
7363
|
-
client_id: clientId,
|
|
7364
|
-
client_secret: clientSecret,
|
|
7365
|
-
required_scopes: scopes
|
|
7366
|
-
};
|
|
7367
|
-
for (const [key, value] of Object.entries({
|
|
7368
|
-
authorize_url: authorizeUrl,
|
|
7369
|
-
token_url: tokenUrl,
|
|
7370
|
-
revoke_url: String(item.revoke_url ?? "").trim(),
|
|
7371
|
-
display_name: String(item.display_name ?? "").trim(),
|
|
7372
|
-
scope_separator: String(item.scope_separator ?? "").trim(),
|
|
7373
|
-
token_endpoint_auth: String(item.token_endpoint_auth ?? "").trim()
|
|
7374
|
-
})) {
|
|
7375
|
-
if (value) record[key] = value;
|
|
7376
|
-
}
|
|
7377
|
-
for (const key of ["pkce_required", "refresh_supported"]) {
|
|
7378
|
-
if (typeof item[key] === "boolean") record[key] = item[key];
|
|
7379
|
-
}
|
|
7380
|
-
if (Array.isArray(item.available_scopes)) {
|
|
7381
|
-
const availableScopes = item.available_scopes.map((scope) => String(scope ?? "").trim()).filter(Boolean);
|
|
7382
|
-
if (availableScopes.length > 0) record.available_scopes = availableScopes;
|
|
7383
|
-
}
|
|
7384
|
-
resolved[providerKey] = record;
|
|
7385
|
-
}
|
|
7386
|
-
return resolved;
|
|
7387
|
-
}
|
|
7388
|
-
function canonicalOauthCredentialsPayload(payload) {
|
|
7389
|
-
const records = oauthProviderRecordsMap(payload);
|
|
7390
|
-
const providerKeys = Object.keys(records).sort();
|
|
7391
|
-
if (providerKeys.length === 0) {
|
|
7392
|
-
return void 0;
|
|
7393
|
-
}
|
|
7394
|
-
return {
|
|
7395
|
-
items: providerKeys.map((providerKey) => records[providerKey])
|
|
7396
|
-
};
|
|
7397
|
-
}
|
|
7398
|
-
function ensureRequiredOauthCredentials(project) {
|
|
7399
|
-
const requiredProviders = requiredOauthProviders(project.manifest.required_connected_accounts ?? []);
|
|
7400
|
-
if (requiredProviders.length === 0) {
|
|
7401
|
-
return;
|
|
7402
|
-
}
|
|
7403
|
-
const provided = new Set(Object.keys(oauthProviderRecordsMap(project.oauth_credentials)));
|
|
7404
|
-
const missing = requiredProviders.filter((provider) => !provided.has(provider));
|
|
7405
|
-
if (missing.length === 0) {
|
|
7406
|
-
return;
|
|
7407
|
-
}
|
|
7408
|
-
const path = project.oauth_credentials_path ?? (0, import_node_path.join)(project.root_dir, "oauth_credentials.json");
|
|
7409
|
-
throw new SiglumeProjectError(
|
|
7410
|
-
`${path} is required for platform-managed OAuth APIs. Missing provider seeds: ${missing.join(", ")}`
|
|
7411
|
-
);
|
|
7412
|
-
}
|
|
7413
7191
|
async function validateProject(path = ".", deps = {}) {
|
|
7414
7192
|
const project = await loadProject(path);
|
|
7415
7193
|
const manifest_issues = await projectValidationIssues(project);
|
|
@@ -7564,10 +7342,21 @@ function ensureExplicitToolManual(project) {
|
|
|
7564
7342
|
async function registrationPreflight(project, client) {
|
|
7565
7343
|
const manifestIssues = await projectValidationIssues(project);
|
|
7566
7344
|
const [toolManualValid, toolManualIssues] = validate_tool_manual(project.tool_manual);
|
|
7345
|
+
const retiredPlatformOauthProviders = requiredOauthProviders(project.manifest.required_connected_accounts ?? []);
|
|
7346
|
+
if (retiredPlatformOauthProviders.length > 0) {
|
|
7347
|
+
throw new SiglumeProjectError(
|
|
7348
|
+
`Registration preflight failed. Fix these before calling auto-register:
|
|
7349
|
+
- platform-managed OAuth is retired. Use managed_by="api" with connect_url: ${retiredPlatformOauthProviders.join(", ")}`
|
|
7350
|
+
);
|
|
7351
|
+
}
|
|
7352
|
+
const apiManagedMissingConnectUrl = apiManagedRequirementsMissingConnectUrl(project.manifest.required_connected_accounts ?? []);
|
|
7353
|
+
if (apiManagedMissingConnectUrl.length > 0) {
|
|
7354
|
+
throw new SiglumeProjectError(
|
|
7355
|
+
`Registration preflight failed. Fix these before calling auto-register:
|
|
7356
|
+
- API-managed OAuth requirements must include connect_url: ${apiManagedMissingConnectUrl.join(", ")}`
|
|
7357
|
+
);
|
|
7358
|
+
}
|
|
7567
7359
|
const remoteQuality = await client.preview_quality_score(project.tool_manual);
|
|
7568
|
-
const requiredOauthProvidersList = requiredOauthProviders(project.manifest.required_connected_accounts ?? []);
|
|
7569
|
-
const oauthProviderRecords = oauthProviderRecordsMap(project.oauth_credentials);
|
|
7570
|
-
const missingOauthProviders = requiredOauthProvidersList.filter((provider) => !oauthProviderRecords[provider]);
|
|
7571
7360
|
const blockingToolManualIssues = toolManualIssues.filter((issue2) => issue2.severity === "error");
|
|
7572
7361
|
const errors = [
|
|
7573
7362
|
...manifestIssues.map((issue2) => String(issue2)),
|
|
@@ -7579,17 +7368,12 @@ async function registrationPreflight(project, client) {
|
|
|
7579
7368
|
if (!remoteQualityOk(remoteQuality)) {
|
|
7580
7369
|
errors.push(`remote Tool Manual quality is not publishable: ${remoteQuality.grade} (${remoteQuality.overall_score}/100)`);
|
|
7581
7370
|
}
|
|
7582
|
-
if (missingOauthProviders.length > 0) {
|
|
7583
|
-
errors.push(`oauth_credentials.json is required for platform-managed OAuth APIs: ${missingOauthProviders.join(", ")}`);
|
|
7584
|
-
}
|
|
7585
7371
|
const preflight = {
|
|
7586
7372
|
manifest_issues: manifestIssues,
|
|
7587
7373
|
tool_manual_valid: toolManualValid,
|
|
7588
7374
|
tool_manual_issues: toolManualIssues.map((issue2) => toJsonable(issue2)),
|
|
7589
7375
|
remote_quality: toJsonable(remoteQuality),
|
|
7590
|
-
|
|
7591
|
-
oauth_credentials_path: project.oauth_credentials_path ?? null,
|
|
7592
|
-
oauth_missing_providers: missingOauthProviders,
|
|
7376
|
+
retired_platform_oauth_providers: retiredPlatformOauthProviders,
|
|
7593
7377
|
ok: errors.length === 0
|
|
7594
7378
|
};
|
|
7595
7379
|
if (errors.length > 0) {
|
|
@@ -7628,8 +7412,6 @@ async function runRegistration(path = ".", options = {}, deps = {}) {
|
|
|
7628
7412
|
ensureExplicitToolManual(project);
|
|
7629
7413
|
ensureManifestPublisherIdentity(project);
|
|
7630
7414
|
ensureRuntimeValidationReady(project);
|
|
7631
|
-
ensureRequiredOauthCredentials(project);
|
|
7632
|
-
const canonicalOauthCredentials = canonicalOauthCredentialsPayload(project.oauth_credentials);
|
|
7633
7415
|
const client = await createClient(deps);
|
|
7634
7416
|
if (requestedCompanySlug) {
|
|
7635
7417
|
const slug = companyNameSlug(requestedCompanySlug);
|
|
@@ -7706,14 +7488,12 @@ async function runRegistration(path = ".", options = {}, deps = {}) {
|
|
|
7706
7488
|
}
|
|
7707
7489
|
}
|
|
7708
7490
|
const receipt = await client.auto_register(project.manifest, project.tool_manual, {
|
|
7709
|
-
runtime_validation: project.runtime_validation
|
|
7710
|
-
oauth_credentials: canonicalOauthCredentials
|
|
7491
|
+
runtime_validation: project.runtime_validation
|
|
7711
7492
|
});
|
|
7712
7493
|
const result = {
|
|
7713
7494
|
receipt: toJsonable(receipt),
|
|
7714
7495
|
registration_preflight: preflight,
|
|
7715
|
-
runtime_validation_path: project.runtime_validation_path ?? null
|
|
7716
|
-
oauth_credentials_path: project.oauth_credentials_path ?? null
|
|
7496
|
+
runtime_validation_path: project.runtime_validation_path ?? null
|
|
7717
7497
|
};
|
|
7718
7498
|
if (developerPortalPreflight) {
|
|
7719
7499
|
result.developer_portal_preflight = developerPortalPreflight;
|
|
@@ -7734,7 +7514,6 @@ async function runPreflight(path = ".", deps = {}) {
|
|
|
7734
7514
|
ensureExplicitToolManual(project);
|
|
7735
7515
|
ensureManifestPublisherIdentity(project);
|
|
7736
7516
|
ensureRuntimeValidationReady(project);
|
|
7737
|
-
ensureRequiredOauthCredentials(project);
|
|
7738
7517
|
const client = await createClient(deps);
|
|
7739
7518
|
const preflight = await registrationPreflight(project, client);
|
|
7740
7519
|
let developerPortalPreflight = null;
|
|
@@ -7752,8 +7531,7 @@ async function runPreflight(path = ".", deps = {}) {
|
|
|
7752
7531
|
ok: true,
|
|
7753
7532
|
adapter_path: project.adapter_path,
|
|
7754
7533
|
registration_preflight: preflight,
|
|
7755
|
-
runtime_validation_path: project.runtime_validation_path ?? null
|
|
7756
|
-
oauth_credentials_path: project.oauth_credentials_path ?? null
|
|
7534
|
+
runtime_validation_path: project.runtime_validation_path ?? null
|
|
7757
7535
|
};
|
|
7758
7536
|
if (developerPortalPreflight) {
|
|
7759
7537
|
result.developer_portal_preflight = developerPortalPreflight;
|
|
@@ -8235,7 +8013,7 @@ function operationReadmeTemplate(operation, manifest, warning) {
|
|
|
8235
8013
|
"- `tool_manual.json`: machine-generated ToolManual scaffold",
|
|
8236
8014
|
"- `runtime_validation.json`: local public endpoint and review-key checks used by auto-register",
|
|
8237
8015
|
"- `docs/api-usage.md`: publishable API usage guide template for `docs_url`",
|
|
8238
|
-
"- `.gitignore`: keeps runtime review keys
|
|
8016
|
+
"- `.gitignore`: keeps runtime review keys out of Git",
|
|
8239
8017
|
"- `tests/test_adapter.ts`: smoke test for `AppTestHarness`",
|
|
8240
8018
|
"",
|
|
8241
8019
|
"Before registering, replace all generated placeholders:",
|
|
@@ -8243,8 +8021,8 @@ function operationReadmeTemplate(operation, manifest, warning) {
|
|
|
8243
8021
|
"- Replace `support_contact` with a real support email address or public support URL.",
|
|
8244
8022
|
"- Optional `seller_homepage_url` is the seller's official site and can stay blank.",
|
|
8245
8023
|
"- In the local `runtime_validation.json`, replace the public URL and review-key placeholders.",
|
|
8246
|
-
"- If the API uses
|
|
8247
|
-
"- Do not commit real review keys or
|
|
8024
|
+
"- If the API uses external OAuth, implement that flow in your API runtime and keep user tokens outside Siglume.",
|
|
8025
|
+
"- Do not commit real review keys or external-provider secrets; the generated `.gitignore` excludes local secret files.",
|
|
8248
8026
|
"- Because `runtime_validation.json` is ignored, GitHub samples do not commit review-key values.",
|
|
8249
8027
|
"",
|
|
8250
8028
|
"## Commands",
|
|
@@ -8320,8 +8098,6 @@ function generatedGitignore() {
|
|
|
8320
8098
|
"!.env.example",
|
|
8321
8099
|
"runtime_validation.json",
|
|
8322
8100
|
"runtime-validation.json",
|
|
8323
|
-
"oauth_credentials.json",
|
|
8324
|
-
"oauth-credentials.json",
|
|
8325
8101
|
"",
|
|
8326
8102
|
"# Python / test artifacts.",
|
|
8327
8103
|
"__pycache__/",
|
|
@@ -8467,13 +8243,6 @@ async function runHarnessForProject(project) {
|
|
|
8467
8243
|
checks.push(executionCheck("quote", await harness.execute_quote(task_type, { input_params: sample_input }), harness));
|
|
8468
8244
|
checks.push(executionCheck("payment", await harness.execute_payment(task_type, { input_params: sample_input }), harness));
|
|
8469
8245
|
}
|
|
8470
|
-
checks.push(
|
|
8471
|
-
executionCheck(
|
|
8472
|
-
"missing_account_simulation",
|
|
8473
|
-
await harness.simulate_connected_account_missing(task_type, { input_params: sample_input }),
|
|
8474
|
-
harness
|
|
8475
|
-
)
|
|
8476
|
-
);
|
|
8477
8246
|
return {
|
|
8478
8247
|
adapter_path: project.adapter_path,
|
|
8479
8248
|
task_type,
|
|
@@ -8576,15 +8345,6 @@ async function findRuntimeValidationPath(root_dir) {
|
|
|
8576
8345
|
}
|
|
8577
8346
|
return null;
|
|
8578
8347
|
}
|
|
8579
|
-
async function findOauthCredentialsPath(root_dir) {
|
|
8580
|
-
for (const name of ["oauth_credentials.json", "oauth-credentials.json"]) {
|
|
8581
|
-
const candidate = (0, import_node_path.join)(root_dir, name);
|
|
8582
|
-
if ((0, import_node_fs.existsSync)(candidate)) {
|
|
8583
|
-
return candidate;
|
|
8584
|
-
}
|
|
8585
|
-
}
|
|
8586
|
-
return null;
|
|
8587
|
-
}
|
|
8588
8348
|
async function loadJsonObject(path, label) {
|
|
8589
8349
|
let payload;
|
|
8590
8350
|
try {
|
|
@@ -8816,15 +8576,15 @@ function readmeTemplate(template) {
|
|
|
8816
8576
|
"- `tool_manual.json`: editable ToolManual draft for validation and registration",
|
|
8817
8577
|
"- `runtime_validation.json`: local live API smoke-test contract used during registration",
|
|
8818
8578
|
"- `docs/api-usage.md`: publish this page and use its public URL as `docs_url`",
|
|
8819
|
-
"- `.gitignore`: keeps runtime review keys
|
|
8579
|
+
"- `.gitignore`: keeps runtime review keys out of Git",
|
|
8820
8580
|
"",
|
|
8821
8581
|
"Before registering, replace all generated placeholders:",
|
|
8822
8582
|
"- In `adapter.ts` and `manifest.json`, replace `docs_url` with a dedicated public API usage guide, not a homepage.",
|
|
8823
8583
|
"- Replace `support_contact` with a real support email address or public support URL.",
|
|
8824
8584
|
"- Optional `seller_homepage_url` is the seller's official site and can stay blank.",
|
|
8825
8585
|
"- In the local `runtime_validation.json`, replace the public URL and review-key placeholders.",
|
|
8826
|
-
"- If the API uses
|
|
8827
|
-
"- Do not commit real review keys or
|
|
8586
|
+
"- If the API uses external OAuth, implement that flow in your API runtime and keep user tokens outside Siglume.",
|
|
8587
|
+
"- Do not commit real review keys or external-provider secrets; the generated `.gitignore` excludes local secret files.",
|
|
8828
8588
|
"- Because `runtime_validation.json` is ignored, GitHub samples do not commit review-key values.",
|
|
8829
8589
|
"",
|
|
8830
8590
|
"Suggested workflow:",
|
|
@@ -9042,7 +8802,6 @@ async function runCli(argv, deps = {}) {
|
|
|
9042
8802
|
emit(stdout, `preflight_quality: ${preflight.remote_quality.grade} (${preflight.remote_quality.overall_score}/100)`);
|
|
9043
8803
|
}
|
|
9044
8804
|
if (report.runtime_validation_path) emit(stdout, `runtime_validation_path: ${String(report.runtime_validation_path)}`);
|
|
9045
|
-
if (report.oauth_credentials_path) emit(stdout, `oauth_credentials_path: ${String(report.oauth_credentials_path)}`);
|
|
9046
8805
|
});
|
|
9047
8806
|
program.command("companies").description("List Siglume companies available for company-name publishing.").option("--json", "emit machine-readable JSON", false).action(async (options) => {
|
|
9048
8807
|
const report = await listCompanyPublishersReport(deps);
|
|
@@ -9093,7 +8852,6 @@ async function runCli(argv, deps = {}) {
|
|
|
9093
8852
|
emit(stdout, `listing_id: ${receipt.listing_id}`);
|
|
9094
8853
|
emit(stdout, `receipt_status: ${receipt.status}`);
|
|
9095
8854
|
if (receipt.listing_status) emit(stdout, `listing_status: ${receipt.listing_status}`);
|
|
9096
|
-
if (receipt.oauth_status) emit(stdout, `oauth_configured: ${Boolean(receipt.oauth_status.configured)}`);
|
|
9097
8855
|
if (receipt.review_url) emit(stdout, `review_url: ${receipt.review_url}`);
|
|
9098
8856
|
if (receipt.trace_id) emit(stdout, `trace_id: ${receipt.trace_id}`);
|
|
9099
8857
|
if (receipt.request_id) emit(stdout, `request_id: ${receipt.request_id}`);
|