@twin3-ai/agent-id 0.3.17 → 0.3.18
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/bin/agent-id.js +41 -40
- package/browser-sdk.js +99 -62
- package/installer.js +23 -3
- package/package.json +1 -1
package/bin/agent-id.js
CHANGED
|
@@ -1517,7 +1517,7 @@ async function runCli(argv) {
|
|
|
1517
1517
|
" agent-id site-key-recovery-complete <url> --challenge <id> --capability-file <secret-file> --key-out <secret-file>",
|
|
1518
1518
|
" agent-id site-key-rotate <url> --key-file <secret-file> --key-out <secret-file> --approve",
|
|
1519
1519
|
" agent-id install-guide <url>",
|
|
1520
|
-
" agent-id install <url> [--modules identity,audit,measurement,optimization,automation] [--grant identity_publish,public_read,telemetry_submit,insights_read,ai_files_write] [--project-root <dir>] [--public-root <dir>] [--apply]",
|
|
1520
|
+
" agent-id install <url> [--modules identity,audit,measurement,optimization,automation] [--grant identity_publish,public_read,telemetry_submit,insights_read,ai_files_write] [--environment production|staging] [--method well_known|dns_txt|html_meta] [--project-root <dir>] [--public-root <dir>] [--apply]",
|
|
1521
1521
|
" agent-id install-resume [--project-root <dir>]",
|
|
1522
1522
|
" agent-id install-uninstall [--project-root <dir>] --approve",
|
|
1523
1523
|
" agent-id enterprise-enroll <url> [--environment production|staging] [--method well_known|dns_txt|html_meta] [--project-root <dir>]",
|
|
@@ -2196,7 +2196,7 @@ async function runCli(argv) {
|
|
|
2196
2196
|
const keyIdx = argv.indexOf("--key");
|
|
2197
2197
|
return print(await post("/api/site_agents/call", {
|
|
2198
2198
|
url,
|
|
2199
|
-
agent_key: keyIdx >= 0 ? argv[keyIdx + 1] : process.env.AEO_AGENT_KEY,
|
|
2199
|
+
agent_key: keyIdx >= 0 ? argv[keyIdx + 1] : (process.env.SITE_AGENT_KEY || process.env.AEO_AGENT_KEY),
|
|
2200
2200
|
action: "insights",
|
|
2201
2201
|
audit_url: argv.includes("--audit")
|
|
2202
2202
|
}));
|
|
@@ -2209,7 +2209,7 @@ async function runCli(argv) {
|
|
|
2209
2209
|
const a2CitationPackage = readJsonFlag(argv, "--a2-package") || readJsonFlag(argv, "--citation-package");
|
|
2210
2210
|
return print(await post("/api/site_agents/call", {
|
|
2211
2211
|
url,
|
|
2212
|
-
agent_key: keyIdx >= 0 ? argv[keyIdx + 1] : process.env.AEO_AGENT_KEY,
|
|
2212
|
+
agent_key: keyIdx >= 0 ? argv[keyIdx + 1] : (process.env.SITE_AGENT_KEY || process.env.AEO_AGENT_KEY),
|
|
2213
2213
|
action: "insights_feed",
|
|
2214
2214
|
audit_url: argv.includes("--audit"),
|
|
2215
2215
|
content: contentIdx >= 0 ? argv[contentIdx + 1] : "",
|
|
@@ -2226,7 +2226,7 @@ async function runCli(argv) {
|
|
|
2226
2226
|
const a2CitationPackage = readJsonFlag(argv, "--a2-package") || readJsonFlag(argv, "--citation-package");
|
|
2227
2227
|
return print(await post("/api/site_agents/call", {
|
|
2228
2228
|
url,
|
|
2229
|
-
agent_key: keyIdx >= 0 ? argv[keyIdx + 1] : process.env.AEO_AGENT_KEY,
|
|
2229
|
+
agent_key: keyIdx >= 0 ? argv[keyIdx + 1] : (process.env.SITE_AGENT_KEY || process.env.AEO_AGENT_KEY),
|
|
2230
2230
|
action: "refresh_insight_inbox",
|
|
2231
2231
|
audit_url: argv.includes("--audit"),
|
|
2232
2232
|
content: contentIdx >= 0 ? argv[contentIdx + 1] : "",
|
|
@@ -2239,7 +2239,7 @@ async function runCli(argv) {
|
|
|
2239
2239
|
const keyIdx = argv.indexOf("--key");
|
|
2240
2240
|
return print(await post("/api/site_agents/call", {
|
|
2241
2241
|
url,
|
|
2242
|
-
agent_key: keyIdx >= 0 ? argv[keyIdx + 1] : process.env.AEO_AGENT_KEY,
|
|
2242
|
+
agent_key: keyIdx >= 0 ? argv[keyIdx + 1] : (process.env.SITE_AGENT_KEY || process.env.AEO_AGENT_KEY),
|
|
2243
2243
|
action: "insight_inbox",
|
|
2244
2244
|
include_acknowledged: argv.includes("--all") || argv.includes("--include-acknowledged")
|
|
2245
2245
|
}));
|
|
@@ -2248,7 +2248,7 @@ async function runCli(argv) {
|
|
|
2248
2248
|
const keyIdx = argv.indexOf("--key");
|
|
2249
2249
|
return print(await post("/api/site_agents/call", {
|
|
2250
2250
|
url,
|
|
2251
|
-
agent_key: keyIdx >= 0 ? argv[keyIdx + 1] : process.env.AEO_AGENT_KEY,
|
|
2251
|
+
agent_key: keyIdx >= 0 ? argv[keyIdx + 1] : (process.env.SITE_AGENT_KEY || process.env.AEO_AGENT_KEY),
|
|
2252
2252
|
action: "acknowledge_insight",
|
|
2253
2253
|
item_id: argv[2] || ""
|
|
2254
2254
|
}));
|
|
@@ -2261,7 +2261,7 @@ async function runCli(argv) {
|
|
|
2261
2261
|
const a2CitationPackage = readJsonFlag(argv, "--a2-package") || readJsonFlag(argv, "--citation-package");
|
|
2262
2262
|
return print(await post("/api/site_agents/call", {
|
|
2263
2263
|
url,
|
|
2264
|
-
agent_key: keyIdx >= 0 ? argv[keyIdx + 1] : process.env.AEO_AGENT_KEY,
|
|
2264
|
+
agent_key: keyIdx >= 0 ? argv[keyIdx + 1] : (process.env.SITE_AGENT_KEY || process.env.AEO_AGENT_KEY),
|
|
2265
2265
|
action: "apply_plan",
|
|
2266
2266
|
audit_url: argv.includes("--audit"),
|
|
2267
2267
|
content: contentIdx >= 0 ? argv[contentIdx + 1] : "",
|
|
@@ -2278,7 +2278,7 @@ async function runCli(argv) {
|
|
|
2278
2278
|
const evidence = evidenceIdx >= 0 ? JSON.parse(fs.readFileSync(argv[evidenceIdx + 1], "utf8")) : undefined;
|
|
2279
2279
|
return print(await post("/api/site_agents/call", {
|
|
2280
2280
|
url,
|
|
2281
|
-
agent_key: keyIdx >= 0 ? argv[keyIdx + 1] : process.env.AEO_AGENT_KEY,
|
|
2281
|
+
agent_key: keyIdx >= 0 ? argv[keyIdx + 1] : (process.env.SITE_AGENT_KEY || process.env.AEO_AGENT_KEY),
|
|
2282
2282
|
action: "apply_evidence",
|
|
2283
2283
|
apply_item_id: argv[2],
|
|
2284
2284
|
evidence_uri: uriIdx >= 0 ? argv[uriIdx + 1] : "",
|
|
@@ -2291,7 +2291,7 @@ async function runCli(argv) {
|
|
|
2291
2291
|
const keyIdx = argv.indexOf("--key");
|
|
2292
2292
|
return print(await post("/api/site_agents/call", {
|
|
2293
2293
|
url,
|
|
2294
|
-
agent_key: keyIdx >= 0 ? argv[keyIdx + 1] : process.env.AEO_AGENT_KEY,
|
|
2294
|
+
agent_key: keyIdx >= 0 ? argv[keyIdx + 1] : (process.env.SITE_AGENT_KEY || process.env.AEO_AGENT_KEY),
|
|
2295
2295
|
action: "outcome_report"
|
|
2296
2296
|
}));
|
|
2297
2297
|
}
|
|
@@ -2299,7 +2299,7 @@ async function runCli(argv) {
|
|
|
2299
2299
|
const keyIdx = argv.indexOf("--key");
|
|
2300
2300
|
return print(await post("/api/site_agents/call", {
|
|
2301
2301
|
url,
|
|
2302
|
-
agent_key: keyIdx >= 0 ? argv[keyIdx + 1] : process.env.AEO_AGENT_KEY,
|
|
2302
|
+
agent_key: keyIdx >= 0 ? argv[keyIdx + 1] : (process.env.SITE_AGENT_KEY || process.env.AEO_AGENT_KEY),
|
|
2303
2303
|
action: "m1_outcome_evidence_package"
|
|
2304
2304
|
}));
|
|
2305
2305
|
}
|
|
@@ -2313,7 +2313,7 @@ async function runCli(argv) {
|
|
|
2313
2313
|
const a2CitationPackage = readJsonFlag(argv, "--a2-package") || readJsonFlag(argv, "--citation-package");
|
|
2314
2314
|
return print(await post("/api/site_agents/call", {
|
|
2315
2315
|
url,
|
|
2316
|
-
agent_key: keyIdx >= 0 ? argv[keyIdx + 1] : process.env.AEO_AGENT_KEY,
|
|
2316
|
+
agent_key: keyIdx >= 0 ? argv[keyIdx + 1] : (process.env.SITE_AGENT_KEY || process.env.AEO_AGENT_KEY),
|
|
2317
2317
|
action: "m2_monthly_optimization_package",
|
|
2318
2318
|
audit_url: argv.includes("--audit"),
|
|
2319
2319
|
content: contentIdx >= 0 ? argv[contentIdx + 1] : "",
|
|
@@ -2334,7 +2334,7 @@ async function runCli(argv) {
|
|
|
2334
2334
|
const a2CitationPackage = readJsonFlag(argv, "--a2-package") || readJsonFlag(argv, "--citation-package");
|
|
2335
2335
|
return print(await post("/api/site_agents/call", {
|
|
2336
2336
|
url,
|
|
2337
|
-
agent_key: keyIdx >= 0 ? argv[keyIdx + 1] : process.env.AEO_AGENT_KEY,
|
|
2337
|
+
agent_key: keyIdx >= 0 ? argv[keyIdx + 1] : (process.env.SITE_AGENT_KEY || process.env.AEO_AGENT_KEY),
|
|
2338
2338
|
action: "m3_monthly_execution_tracker",
|
|
2339
2339
|
audit_url: argv.includes("--audit"),
|
|
2340
2340
|
content: contentIdx >= 0 ? argv[contentIdx + 1] : "",
|
|
@@ -2355,7 +2355,7 @@ async function runCli(argv) {
|
|
|
2355
2355
|
const a2CitationPackage = readJsonFlag(argv, "--a2-package") || readJsonFlag(argv, "--citation-package");
|
|
2356
2356
|
return print(await post("/api/site_agents/call", {
|
|
2357
2357
|
url,
|
|
2358
|
-
agent_key: keyIdx >= 0 ? argv[keyIdx + 1] : process.env.AEO_AGENT_KEY,
|
|
2358
|
+
agent_key: keyIdx >= 0 ? argv[keyIdx + 1] : (process.env.SITE_AGENT_KEY || process.env.AEO_AGENT_KEY),
|
|
2359
2359
|
action: "m4_monthly_outcome_scorecard",
|
|
2360
2360
|
audit_url: argv.includes("--audit"),
|
|
2361
2361
|
content: contentIdx >= 0 ? argv[contentIdx + 1] : "",
|
|
@@ -2376,7 +2376,7 @@ async function runCli(argv) {
|
|
|
2376
2376
|
const a2CitationPackage = readJsonFlag(argv, "--a2-package") || readJsonFlag(argv, "--citation-package");
|
|
2377
2377
|
return print(await post("/api/site_agents/call", {
|
|
2378
2378
|
url,
|
|
2379
|
-
agent_key: keyIdx >= 0 ? argv[keyIdx + 1] : process.env.AEO_AGENT_KEY,
|
|
2379
|
+
agent_key: keyIdx >= 0 ? argv[keyIdx + 1] : (process.env.SITE_AGENT_KEY || process.env.AEO_AGENT_KEY),
|
|
2380
2380
|
action: "m5_monthly_dashboard",
|
|
2381
2381
|
audit_url: argv.includes("--audit"),
|
|
2382
2382
|
content: contentIdx >= 0 ? argv[contentIdx + 1] : "",
|
|
@@ -2397,7 +2397,7 @@ async function runCli(argv) {
|
|
|
2397
2397
|
const a2CitationPackage = readJsonFlag(argv, "--a2-package") || readJsonFlag(argv, "--citation-package");
|
|
2398
2398
|
return print(await post("/api/site_agents/call", {
|
|
2399
2399
|
url,
|
|
2400
|
-
agent_key: keyIdx >= 0 ? argv[keyIdx + 1] : process.env.AEO_AGENT_KEY,
|
|
2400
|
+
agent_key: keyIdx >= 0 ? argv[keyIdx + 1] : (process.env.SITE_AGENT_KEY || process.env.AEO_AGENT_KEY),
|
|
2401
2401
|
action: "monthly_evidence_loop",
|
|
2402
2402
|
audit_url: argv.includes("--audit"),
|
|
2403
2403
|
content: contentIdx >= 0 ? argv[contentIdx + 1] : "",
|
|
@@ -2412,7 +2412,7 @@ async function runCli(argv) {
|
|
|
2412
2412
|
const keyIdx = argv.indexOf("--key");
|
|
2413
2413
|
return print(await post("/api/site_agents/call", {
|
|
2414
2414
|
url,
|
|
2415
|
-
agent_key: keyIdx >= 0 ? argv[keyIdx + 1] : process.env.AEO_AGENT_KEY,
|
|
2415
|
+
agent_key: keyIdx >= 0 ? argv[keyIdx + 1] : (process.env.SITE_AGENT_KEY || process.env.AEO_AGENT_KEY),
|
|
2416
2416
|
action: "optimization_cycle",
|
|
2417
2417
|
audit_url: argv.includes("--audit")
|
|
2418
2418
|
}));
|
|
@@ -2421,7 +2421,7 @@ async function runCli(argv) {
|
|
|
2421
2421
|
const keyIdx = argv.indexOf("--key");
|
|
2422
2422
|
return print(await post("/api/site_agents/call", {
|
|
2423
2423
|
url,
|
|
2424
|
-
agent_key: keyIdx >= 0 ? argv[keyIdx + 1] : process.env.AEO_AGENT_KEY,
|
|
2424
|
+
agent_key: keyIdx >= 0 ? argv[keyIdx + 1] : (process.env.SITE_AGENT_KEY || process.env.AEO_AGENT_KEY),
|
|
2425
2425
|
action: "audit_file_package",
|
|
2426
2426
|
audit_url: argv.includes("--audit")
|
|
2427
2427
|
}));
|
|
@@ -2430,7 +2430,7 @@ async function runCli(argv) {
|
|
|
2430
2430
|
const keyIdx = argv.indexOf("--key");
|
|
2431
2431
|
return print(await post("/api/site_agents/call", {
|
|
2432
2432
|
url,
|
|
2433
|
-
agent_key: keyIdx >= 0 ? argv[keyIdx + 1] : process.env.AEO_AGENT_KEY,
|
|
2433
|
+
agent_key: keyIdx >= 0 ? argv[keyIdx + 1] : (process.env.SITE_AGENT_KEY || process.env.AEO_AGENT_KEY),
|
|
2434
2434
|
action: "skill_package"
|
|
2435
2435
|
}));
|
|
2436
2436
|
}
|
|
@@ -2438,7 +2438,7 @@ async function runCli(argv) {
|
|
|
2438
2438
|
const keyIdx = argv.indexOf("--key");
|
|
2439
2439
|
return print(await post("/api/site_agents/call", {
|
|
2440
2440
|
url,
|
|
2441
|
-
agent_key: keyIdx >= 0 ? argv[keyIdx + 1] : process.env.AEO_AGENT_KEY,
|
|
2441
|
+
agent_key: keyIdx >= 0 ? argv[keyIdx + 1] : (process.env.SITE_AGENT_KEY || process.env.AEO_AGENT_KEY),
|
|
2442
2442
|
action: "implementation_bundle",
|
|
2443
2443
|
audit_url: argv.includes("--audit")
|
|
2444
2444
|
}));
|
|
@@ -2447,7 +2447,7 @@ async function runCli(argv) {
|
|
|
2447
2447
|
const keyIdx = argv.indexOf("--key");
|
|
2448
2448
|
return print(await post("/api/site_agents/call", {
|
|
2449
2449
|
url,
|
|
2450
|
-
agent_key: keyIdx >= 0 ? argv[keyIdx + 1] : process.env.AEO_AGENT_KEY,
|
|
2450
|
+
agent_key: keyIdx >= 0 ? argv[keyIdx + 1] : (process.env.SITE_AGENT_KEY || process.env.AEO_AGENT_KEY),
|
|
2451
2451
|
action: "install_descriptor"
|
|
2452
2452
|
}));
|
|
2453
2453
|
}
|
|
@@ -2455,7 +2455,7 @@ async function runCli(argv) {
|
|
|
2455
2455
|
const keyIdx = argv.indexOf("--key");
|
|
2456
2456
|
return print(await post("/api/site_agents/call", {
|
|
2457
2457
|
url,
|
|
2458
|
-
agent_key: keyIdx >= 0 ? argv[keyIdx + 1] : process.env.AEO_AGENT_KEY,
|
|
2458
|
+
agent_key: keyIdx >= 0 ? argv[keyIdx + 1] : (process.env.SITE_AGENT_KEY || process.env.AEO_AGENT_KEY),
|
|
2459
2459
|
action: "installation_verification",
|
|
2460
2460
|
audit_url: argv.includes("--audit")
|
|
2461
2461
|
}));
|
|
@@ -2467,7 +2467,7 @@ async function runCli(argv) {
|
|
|
2467
2467
|
const competitorIdx = argv.indexOf("--competitor");
|
|
2468
2468
|
return print(await post("/api/site_agents/call", {
|
|
2469
2469
|
url,
|
|
2470
|
-
agent_key: keyIdx >= 0 ? argv[keyIdx + 1] : process.env.AEO_AGENT_KEY,
|
|
2470
|
+
agent_key: keyIdx >= 0 ? argv[keyIdx + 1] : (process.env.SITE_AGENT_KEY || process.env.AEO_AGENT_KEY),
|
|
2471
2471
|
action: "content_optimization_plan",
|
|
2472
2472
|
content: contentIdx >= 0 ? argv[contentIdx + 1] : "",
|
|
2473
2473
|
questions: questionIdx >= 0 ? [argv[questionIdx + 1]] : [],
|
|
@@ -2483,7 +2483,7 @@ async function runCli(argv) {
|
|
|
2483
2483
|
const engineIdx = argv.indexOf("--engine");
|
|
2484
2484
|
return print(await post("/api/site_agents/call", {
|
|
2485
2485
|
url,
|
|
2486
|
-
agent_key: keyIdx >= 0 ? argv[keyIdx + 1] : process.env.AEO_AGENT_KEY,
|
|
2486
|
+
agent_key: keyIdx >= 0 ? argv[keyIdx + 1] : (process.env.SITE_AGENT_KEY || process.env.AEO_AGENT_KEY),
|
|
2487
2487
|
action: "content_workflow_package",
|
|
2488
2488
|
content: contentIdx >= 0 ? argv[contentIdx + 1] : "",
|
|
2489
2489
|
questions: questionIdx >= 0 ? [argv[questionIdx + 1]] : [],
|
|
@@ -2502,7 +2502,7 @@ async function runCli(argv) {
|
|
|
2502
2502
|
const publishedItems = evidenceIdx >= 0 ? JSON.parse(fs.readFileSync(argv[evidenceIdx + 1], "utf8")) : [];
|
|
2503
2503
|
return print(await post("/api/site_agents/call", {
|
|
2504
2504
|
url,
|
|
2505
|
-
agent_key: keyIdx >= 0 ? argv[keyIdx + 1] : process.env.AEO_AGENT_KEY,
|
|
2505
|
+
agent_key: keyIdx >= 0 ? argv[keyIdx + 1] : (process.env.SITE_AGENT_KEY || process.env.AEO_AGENT_KEY),
|
|
2506
2506
|
action: "content_pack",
|
|
2507
2507
|
content: contentIdx >= 0 ? argv[contentIdx + 1] : "",
|
|
2508
2508
|
questions: questionIdx >= 0 ? [argv[questionIdx + 1]] : [],
|
|
@@ -2521,7 +2521,7 @@ async function runCli(argv) {
|
|
|
2521
2521
|
const reviewGate = reviewGateIdx >= 0 ? JSON.parse(fs.readFileSync(argv[reviewGateIdx + 1], "utf8")) : undefined;
|
|
2522
2522
|
return print(await post("/api/site_agents/call", {
|
|
2523
2523
|
url,
|
|
2524
|
-
agent_key: keyIdx >= 0 ? argv[keyIdx + 1] : process.env.AEO_AGENT_KEY,
|
|
2524
|
+
agent_key: keyIdx >= 0 ? argv[keyIdx + 1] : (process.env.SITE_AGENT_KEY || process.env.AEO_AGENT_KEY),
|
|
2525
2525
|
action: "content_repair_pack",
|
|
2526
2526
|
...(reviewGate ? { review_gate: reviewGate } : {}),
|
|
2527
2527
|
content: contentIdx >= 0 ? argv[contentIdx + 1] : "",
|
|
@@ -2534,7 +2534,7 @@ async function runCli(argv) {
|
|
|
2534
2534
|
const publishedItems = evidenceIdx >= 0 ? JSON.parse(fs.readFileSync(argv[evidenceIdx + 1], "utf8")) : [];
|
|
2535
2535
|
return print(await post("/api/site_agents/call", {
|
|
2536
2536
|
url,
|
|
2537
|
-
agent_key: keyIdx >= 0 ? argv[keyIdx + 1] : process.env.AEO_AGENT_KEY,
|
|
2537
|
+
agent_key: keyIdx >= 0 ? argv[keyIdx + 1] : (process.env.SITE_AGENT_KEY || process.env.AEO_AGENT_KEY),
|
|
2538
2538
|
action: "content_publication_package",
|
|
2539
2539
|
published_items: publishedItems,
|
|
2540
2540
|
audit_url: argv.includes("--audit"),
|
|
@@ -2548,7 +2548,7 @@ async function runCli(argv) {
|
|
|
2548
2548
|
const competitorIdx = argv.indexOf("--competitor");
|
|
2549
2549
|
return print(await post("/api/site_agents/call", {
|
|
2550
2550
|
url,
|
|
2551
|
-
agent_key: keyIdx >= 0 ? argv[keyIdx + 1] : process.env.AEO_AGENT_KEY,
|
|
2551
|
+
agent_key: keyIdx >= 0 ? argv[keyIdx + 1] : (process.env.SITE_AGENT_KEY || process.env.AEO_AGENT_KEY),
|
|
2552
2552
|
action: "citation_gap_matrix",
|
|
2553
2553
|
content: contentIdx >= 0 ? argv[contentIdx + 1] : "",
|
|
2554
2554
|
questions: questionIdx >= 0 ? [argv[questionIdx + 1]] : [],
|
|
@@ -2563,7 +2563,7 @@ async function runCli(argv) {
|
|
|
2563
2563
|
const competitorIdx = argv.indexOf("--competitor");
|
|
2564
2564
|
return print(await post("/api/site_agents/call", {
|
|
2565
2565
|
url,
|
|
2566
|
-
agent_key: keyIdx >= 0 ? argv[keyIdx + 1] : process.env.AEO_AGENT_KEY,
|
|
2566
|
+
agent_key: keyIdx >= 0 ? argv[keyIdx + 1] : (process.env.SITE_AGENT_KEY || process.env.AEO_AGENT_KEY),
|
|
2567
2567
|
action: "community_citation_plan",
|
|
2568
2568
|
content: contentIdx >= 0 ? argv[contentIdx + 1] : "",
|
|
2569
2569
|
questions: questionIdx >= 0 ? [argv[questionIdx + 1]] : [],
|
|
@@ -2580,7 +2580,7 @@ async function runCli(argv) {
|
|
|
2580
2580
|
const marketIdx = argv.indexOf("--market");
|
|
2581
2581
|
return print(await post("/api/site_agents/call", {
|
|
2582
2582
|
url,
|
|
2583
|
-
agent_key: keyIdx >= 0 ? argv[keyIdx + 1] : process.env.AEO_AGENT_KEY,
|
|
2583
|
+
agent_key: keyIdx >= 0 ? argv[keyIdx + 1] : (process.env.SITE_AGENT_KEY || process.env.AEO_AGENT_KEY),
|
|
2584
2584
|
action: "prompt_test_run_sheet",
|
|
2585
2585
|
questions: questionIdx >= 0 ? [argv[questionIdx + 1]] : [],
|
|
2586
2586
|
topics: topicIdx >= 0 ? [argv[topicIdx + 1]] : [],
|
|
@@ -2596,7 +2596,7 @@ async function runCli(argv) {
|
|
|
2596
2596
|
return print(await post("/api/site_agents/call", {
|
|
2597
2597
|
...payload,
|
|
2598
2598
|
url,
|
|
2599
|
-
agent_key: keyIdx >= 0 ? argv[keyIdx + 1] : process.env.AEO_AGENT_KEY,
|
|
2599
|
+
agent_key: keyIdx >= 0 ? argv[keyIdx + 1] : (process.env.SITE_AGENT_KEY || process.env.AEO_AGENT_KEY),
|
|
2600
2600
|
action: "prompt_test_results"
|
|
2601
2601
|
}));
|
|
2602
2602
|
}
|
|
@@ -2606,7 +2606,7 @@ async function runCli(argv) {
|
|
|
2606
2606
|
const events = eventsIdx >= 0 ? JSON.parse(fs.readFileSync(argv[eventsIdx + 1], "utf8")) : [];
|
|
2607
2607
|
return print(await post("/api/site_agents/call", {
|
|
2608
2608
|
url,
|
|
2609
|
-
agent_key: keyIdx >= 0 ? argv[keyIdx + 1] : process.env.AEO_AGENT_KEY,
|
|
2609
|
+
agent_key: keyIdx >= 0 ? argv[keyIdx + 1] : (process.env.SITE_AGENT_KEY || process.env.AEO_AGENT_KEY),
|
|
2610
2610
|
action: "b1_conversion_evidence_package",
|
|
2611
2611
|
events
|
|
2612
2612
|
}));
|
|
@@ -2618,7 +2618,7 @@ async function runCli(argv) {
|
|
|
2618
2618
|
const evaluatorIdx = argv.indexOf("--evaluator");
|
|
2619
2619
|
return print(await post("/api/site_agents/call", {
|
|
2620
2620
|
url,
|
|
2621
|
-
agent_key: keyIdx >= 0 ? argv[keyIdx + 1] : process.env.AEO_AGENT_KEY,
|
|
2621
|
+
agent_key: keyIdx >= 0 ? argv[keyIdx + 1] : (process.env.SITE_AGENT_KEY || process.env.AEO_AGENT_KEY),
|
|
2622
2622
|
action: "job_drafts",
|
|
2623
2623
|
currency: currencyIdx >= 0 ? argv[currencyIdx + 1] : undefined,
|
|
2624
2624
|
provider: providerIdx >= 0 ? argv[providerIdx + 1] : undefined,
|
|
@@ -2631,7 +2631,7 @@ async function runCli(argv) {
|
|
|
2631
2631
|
const draft = JSON.parse(fs.readFileSync(argv[2], "utf8"));
|
|
2632
2632
|
return print(await post("/api/site_agents/call", {
|
|
2633
2633
|
url,
|
|
2634
|
-
agent_key: keyIdx >= 0 ? argv[keyIdx + 1] : process.env.AEO_AGENT_KEY,
|
|
2634
|
+
agent_key: keyIdx >= 0 ? argv[keyIdx + 1] : (process.env.SITE_AGENT_KEY || process.env.AEO_AGENT_KEY),
|
|
2635
2635
|
action: "accept_job_draft",
|
|
2636
2636
|
draft
|
|
2637
2637
|
}));
|
|
@@ -2644,7 +2644,7 @@ async function runCli(argv) {
|
|
|
2644
2644
|
const draft = argv[2] && !argv[2].startsWith("--") ? JSON.parse(fs.readFileSync(argv[2], "utf8")) : undefined;
|
|
2645
2645
|
return print(await post("/api/site_agents/call", {
|
|
2646
2646
|
url,
|
|
2647
|
-
agent_key: keyIdx >= 0 ? argv[keyIdx + 1] : process.env.AEO_AGENT_KEY,
|
|
2647
|
+
agent_key: keyIdx >= 0 ? argv[keyIdx + 1] : (process.env.SITE_AGENT_KEY || process.env.AEO_AGENT_KEY),
|
|
2648
2648
|
action: "decide_job_draft",
|
|
2649
2649
|
decision: decisionIdx >= 0 ? argv[decisionIdx + 1] : "defer",
|
|
2650
2650
|
draft,
|
|
@@ -2658,7 +2658,7 @@ async function runCli(argv) {
|
|
|
2658
2658
|
const draftIdIdx = argv.indexOf("--draft-id");
|
|
2659
2659
|
return print(await post("/api/site_agents/call", {
|
|
2660
2660
|
url,
|
|
2661
|
-
agent_key: keyIdx >= 0 ? argv[keyIdx + 1] : process.env.AEO_AGENT_KEY,
|
|
2661
|
+
agent_key: keyIdx >= 0 ? argv[keyIdx + 1] : (process.env.SITE_AGENT_KEY || process.env.AEO_AGENT_KEY),
|
|
2662
2662
|
action: "draft_decisions",
|
|
2663
2663
|
decision: decisionIdx >= 0 ? argv[decisionIdx + 1] : undefined,
|
|
2664
2664
|
draft_id: draftIdIdx >= 0 ? argv[draftIdIdx + 1] : undefined
|
|
@@ -2670,7 +2670,7 @@ async function runCli(argv) {
|
|
|
2670
2670
|
const itemIdx = argv.indexOf("--item-id");
|
|
2671
2671
|
return print(await post("/api/site_agents/call", {
|
|
2672
2672
|
url,
|
|
2673
|
-
agent_key: keyIdx >= 0 ? argv[keyIdx + 1] : process.env.AEO_AGENT_KEY,
|
|
2673
|
+
agent_key: keyIdx >= 0 ? argv[keyIdx + 1] : (process.env.SITE_AGENT_KEY || process.env.AEO_AGENT_KEY),
|
|
2674
2674
|
action: "decision_reviews",
|
|
2675
2675
|
decision: decisionIdx >= 0 ? argv[decisionIdx + 1] : undefined,
|
|
2676
2676
|
apply_item_id: itemIdx >= 0 ? argv[itemIdx + 1] : undefined
|
|
@@ -2678,12 +2678,12 @@ async function runCli(argv) {
|
|
|
2678
2678
|
}
|
|
2679
2679
|
if (cmd === "site-jobs") {
|
|
2680
2680
|
const keyIdx = argv.indexOf("--key");
|
|
2681
|
-
const agentKey = keyIdx >= 0 ? argv[keyIdx + 1] : process.env.AEO_AGENT_KEY;
|
|
2681
|
+
const agentKey = keyIdx >= 0 ? argv[keyIdx + 1] : (process.env.SITE_AGENT_KEY || process.env.AEO_AGENT_KEY);
|
|
2682
2682
|
return print(await post("/api/site_agents/call", { url, agent_key: agentKey, action: "jobs" }));
|
|
2683
2683
|
}
|
|
2684
2684
|
if (cmd === "site-c5-repairs") {
|
|
2685
2685
|
const keyIdx = argv.indexOf("--key");
|
|
2686
|
-
const agentKey = keyIdx >= 0 ? argv[keyIdx + 1] : process.env.AEO_AGENT_KEY;
|
|
2686
|
+
const agentKey = keyIdx >= 0 ? argv[keyIdx + 1] : (process.env.SITE_AGENT_KEY || process.env.AEO_AGENT_KEY);
|
|
2687
2687
|
return print(await post("/api/site_agents/call", { url, agent_key: agentKey, action: "c5_repair_history" }));
|
|
2688
2688
|
}
|
|
2689
2689
|
if (cmd === "site-job-evidence") {
|
|
@@ -2693,7 +2693,7 @@ async function runCli(argv) {
|
|
|
2693
2693
|
const evidence = evidenceIdx >= 0 ? JSON.parse(fs.readFileSync(argv[evidenceIdx + 1], "utf8")) : undefined;
|
|
2694
2694
|
return print(await post("/api/site_agents/call", {
|
|
2695
2695
|
url,
|
|
2696
|
-
agent_key: keyIdx >= 0 ? argv[keyIdx + 1] : process.env.AEO_AGENT_KEY,
|
|
2696
|
+
agent_key: keyIdx >= 0 ? argv[keyIdx + 1] : (process.env.SITE_AGENT_KEY || process.env.AEO_AGENT_KEY),
|
|
2697
2697
|
action: "report_job_evidence",
|
|
2698
2698
|
job_id: argv[2],
|
|
2699
2699
|
evidence_uri: uriIdx >= 0 ? argv[uriIdx + 1] : "",
|
|
@@ -3278,7 +3278,8 @@ async function runCli(argv) {
|
|
|
3278
3278
|
return print(await post("/api/site_agents/verify_domain", { url, method }));
|
|
3279
3279
|
}
|
|
3280
3280
|
if (cmd === "verify") {
|
|
3281
|
-
const
|
|
3281
|
+
const keyIdx = argv.indexOf("--key");
|
|
3282
|
+
const key = keyIdx >= 0 ? argv[keyIdx + 1] : (process.env.SITE_AGENT_KEY || process.env.AEO_AGENT_KEY);
|
|
3282
3283
|
return print(await post("/api/site_agents/verify", { url, agent_key: key }));
|
|
3283
3284
|
}
|
|
3284
3285
|
if (cmd === "mcp") return runMcp();
|
package/browser-sdk.js
CHANGED
|
@@ -1,74 +1,88 @@
|
|
|
1
1
|
(function () {
|
|
2
|
-
"
|
|
2
|
+
if (typeof window === "undefined" || typeof document === "undefined") {
|
|
3
|
+
// Not a browser: loaded via require()/import in Node. This module is the
|
|
4
|
+
// browser sensor script; expose only a descriptor so tooling can locate it.
|
|
5
|
+
if (typeof module !== "undefined" && module.exports !== undefined) {
|
|
6
|
+
module.exports = {
|
|
7
|
+
browser_only: true,
|
|
8
|
+
script: "browser-sdk.js",
|
|
9
|
+
usage: "Serve this file to browsers with a <script> tag (see site_agent_install_descriptor); it exposes no Node API."
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
3
14
|
var w = window;
|
|
4
15
|
var d = document;
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
var endpoint =
|
|
8
|
-
var agentId =
|
|
9
|
-
var
|
|
10
|
-
var
|
|
11
|
-
|
|
12
|
-
|
|
16
|
+
var s = d.currentScript || {};
|
|
17
|
+
var cfg = w.twin3AEO || {};
|
|
18
|
+
var endpoint = cfg.endpoint || s.getAttribute && s.getAttribute("data-endpoint") || "/api/agent/sdk_event";
|
|
19
|
+
var agentId = cfg.agentId || s.getAttribute && s.getAttribute("data-agent-id") || "";
|
|
20
|
+
var siteToken = cfg.siteToken || s.getAttribute && s.getAttribute("data-site-token") || "";
|
|
21
|
+
var eventName = cfg.event || "page_view";
|
|
22
|
+
var aiRefHosts = /(chatgpt|openai|perplexity|gemini|bard|claude|anthropic|copilot|bing|you\.com|poe\.com)/i;
|
|
23
|
+
var clsScore = 0;
|
|
24
|
+
var clsEntries = 0;
|
|
25
|
+
|
|
26
|
+
function clip(value, n) {
|
|
13
27
|
value = value == null ? "" : String(value);
|
|
14
|
-
return value.length >
|
|
28
|
+
return value.length > n ? value.slice(0, n) : value;
|
|
15
29
|
}
|
|
16
30
|
|
|
17
|
-
function attr(
|
|
18
|
-
return
|
|
31
|
+
function attr(el, name) {
|
|
32
|
+
return el && el.getAttribute ? (el.getAttribute(name) || "") : "";
|
|
19
33
|
}
|
|
20
34
|
|
|
21
|
-
function text(
|
|
22
|
-
return clip((
|
|
35
|
+
function text(el) {
|
|
36
|
+
return clip((el && el.textContent || "").replace(/\s+/g, " ").trim(), 160);
|
|
23
37
|
}
|
|
24
38
|
|
|
25
39
|
function meta(name) {
|
|
26
|
-
var
|
|
27
|
-
return attr(
|
|
40
|
+
var el = d.querySelector('meta[name="' + name + '"],meta[property="' + name + '"]');
|
|
41
|
+
return attr(el, "content");
|
|
28
42
|
}
|
|
29
43
|
|
|
30
|
-
function
|
|
31
|
-
if (!
|
|
32
|
-
return !!(attr(
|
|
44
|
+
function hasName(el) {
|
|
45
|
+
if (!el) return false;
|
|
46
|
+
return !!(attr(el, "aria-label") || attr(el, "title") || attr(el, "alt") || attr(el, "placeholder") || attr(el, "name") || text(el));
|
|
33
47
|
}
|
|
34
48
|
|
|
35
|
-
function cleanData(
|
|
36
|
-
if (!
|
|
37
|
-
var
|
|
38
|
-
Object.keys(
|
|
49
|
+
function cleanData(obj, depth) {
|
|
50
|
+
if (!obj || typeof obj !== "object" || depth > 2) return obj;
|
|
51
|
+
var out = Array.isArray(obj) ? [] : {};
|
|
52
|
+
Object.keys(obj).slice(0, 40).forEach(function (key) {
|
|
39
53
|
var low = key.toLowerCase();
|
|
40
54
|
if (/email|phone|tel|name|note|message|token|key|secret|password/.test(low)) {
|
|
41
|
-
|
|
55
|
+
out[key] = "[redacted]";
|
|
42
56
|
return;
|
|
43
57
|
}
|
|
44
|
-
var
|
|
45
|
-
if (typeof
|
|
46
|
-
else if (typeof
|
|
47
|
-
else if (
|
|
58
|
+
var v = obj[key];
|
|
59
|
+
if (typeof v === "string") out[key] = clip(v, 160);
|
|
60
|
+
else if (typeof v === "number" || typeof v === "boolean") out[key] = v;
|
|
61
|
+
else if (v && typeof v === "object") out[key] = cleanData(v, depth + 1);
|
|
48
62
|
});
|
|
49
|
-
return
|
|
63
|
+
return out;
|
|
50
64
|
}
|
|
51
65
|
|
|
52
66
|
function collectSignals() {
|
|
53
67
|
var forms = Array.prototype.slice.call(d.querySelectorAll("form"));
|
|
54
|
-
var webmcpForms = forms.filter(function (
|
|
68
|
+
var webmcpForms = forms.filter(function (f) { return attr(f, "toolname") && attr(f, "tooldescription"); });
|
|
55
69
|
var badToolInputs = 0;
|
|
56
|
-
webmcpForms.forEach(function (
|
|
57
|
-
Array.prototype.slice.call(
|
|
58
|
-
if ((attr(
|
|
59
|
-
if (!attr(
|
|
70
|
+
webmcpForms.forEach(function (f) {
|
|
71
|
+
Array.prototype.slice.call(f.querySelectorAll("input,select,textarea")).forEach(function (el) {
|
|
72
|
+
if ((attr(el, "type") || "").toLowerCase() === "hidden") return;
|
|
73
|
+
if (!attr(el, "name")) badToolInputs += 1;
|
|
60
74
|
});
|
|
61
75
|
});
|
|
62
76
|
var interactive = Array.prototype.slice.call(d.querySelectorAll("a,button,input,select,textarea"));
|
|
63
|
-
var namedInteractive = interactive.filter(function (
|
|
64
|
-
if (
|
|
65
|
-
return
|
|
77
|
+
var namedInteractive = interactive.filter(function (el) {
|
|
78
|
+
if (el.tagName === "INPUT" && (attr(el, "type") || "").toLowerCase() === "hidden") return true;
|
|
79
|
+
return hasName(el);
|
|
66
80
|
});
|
|
67
|
-
var
|
|
68
|
-
var
|
|
69
|
-
var
|
|
70
|
-
var
|
|
71
|
-
try {
|
|
81
|
+
var imgs = Array.prototype.slice.call(d.querySelectorAll("img"));
|
|
82
|
+
var missingImgSize = imgs.filter(function (img) { return !(attr(img, "width") && attr(img, "height")); });
|
|
83
|
+
var ref = d.referrer || "";
|
|
84
|
+
var refHost = "";
|
|
85
|
+
try { refHost = ref ? (new URL(ref)).hostname : ""; } catch (_) { refHost = ""; }
|
|
72
86
|
return {
|
|
73
87
|
title_len: (d.title || "").length,
|
|
74
88
|
description_len: meta("description").length,
|
|
@@ -83,30 +97,48 @@
|
|
|
83
97
|
webmcp_bad_inputs: badToolInputs,
|
|
84
98
|
interactive: interactive.length,
|
|
85
99
|
named_interactive: namedInteractive.length,
|
|
86
|
-
images:
|
|
87
|
-
images_missing_size:
|
|
88
|
-
|
|
89
|
-
|
|
100
|
+
images: imgs.length,
|
|
101
|
+
images_missing_size: missingImgSize.length,
|
|
102
|
+
cls_score: Math.round(clsScore * 10000) / 10000,
|
|
103
|
+
cls_entries: clsEntries,
|
|
104
|
+
referrer_host: clip(refHost, 80),
|
|
105
|
+
ai_referrer: aiRefHosts.test(ref)
|
|
90
106
|
};
|
|
91
107
|
}
|
|
92
108
|
|
|
109
|
+
function observeLayoutShift() {
|
|
110
|
+
if (!("PerformanceObserver" in w)) return;
|
|
111
|
+
try {
|
|
112
|
+
var observer = new PerformanceObserver(function (list) {
|
|
113
|
+
list.getEntries().forEach(function (entry) {
|
|
114
|
+
if (entry.hadRecentInput) return;
|
|
115
|
+
clsScore += entry.value || 0;
|
|
116
|
+
clsEntries += 1;
|
|
117
|
+
});
|
|
118
|
+
});
|
|
119
|
+
observer.observe({ type: "layout-shift", buffered: true });
|
|
120
|
+
} catch (_) {}
|
|
121
|
+
}
|
|
122
|
+
|
|
93
123
|
function payload(event, data) {
|
|
94
|
-
var
|
|
95
|
-
sdk: "
|
|
96
|
-
sdk_version: "0.3
|
|
97
|
-
event: event ||
|
|
124
|
+
var out = {
|
|
125
|
+
sdk: "aeo-site-sdk",
|
|
126
|
+
sdk_version: "0.2.3",
|
|
127
|
+
event: event || eventName,
|
|
128
|
+
timestamp: new Date().toISOString(),
|
|
98
129
|
agent_id: agentId,
|
|
99
130
|
url: location.href,
|
|
100
131
|
path: location.pathname
|
|
101
132
|
};
|
|
102
|
-
if (
|
|
103
|
-
|
|
133
|
+
if (siteToken) out.site_token = siteToken;
|
|
134
|
+
if (data) out.data = cleanData(data, 0);
|
|
135
|
+
return JSON.stringify(out);
|
|
104
136
|
}
|
|
105
137
|
|
|
106
138
|
function post(body) {
|
|
107
139
|
if (navigator.sendBeacon) {
|
|
108
|
-
var
|
|
109
|
-
if (
|
|
140
|
+
var ok = navigator.sendBeacon(endpoint, new Blob([body], { type: "application/json" }));
|
|
141
|
+
if (ok) return;
|
|
110
142
|
}
|
|
111
143
|
fetch(endpoint, {
|
|
112
144
|
method: "POST",
|
|
@@ -117,33 +149,38 @@
|
|
|
117
149
|
}).catch(function () {});
|
|
118
150
|
}
|
|
119
151
|
|
|
120
|
-
function
|
|
152
|
+
function send(event, data) {
|
|
121
153
|
post(payload(event, data));
|
|
122
154
|
}
|
|
123
155
|
|
|
124
156
|
function signal(extra) {
|
|
125
|
-
|
|
157
|
+
send("page_signal", { signals: collectSignals(), extra: extra || {} });
|
|
126
158
|
}
|
|
127
159
|
|
|
128
160
|
function conversion(name, data) {
|
|
129
|
-
|
|
161
|
+
send("conversion", { conversion: clip(name || "conversion", 80), referrer: d.referrer || "", value: cleanData(data || {}, 0) });
|
|
130
162
|
}
|
|
131
163
|
|
|
132
164
|
w.twin3AEO = {
|
|
133
165
|
agentId: agentId,
|
|
166
|
+
siteToken: siteToken,
|
|
134
167
|
endpoint: endpoint,
|
|
135
|
-
version: "0.3
|
|
136
|
-
track:
|
|
168
|
+
version: "0.2.3",
|
|
169
|
+
track: send,
|
|
137
170
|
signal: signal,
|
|
138
171
|
conversion: conversion,
|
|
139
172
|
collectSignals: collectSignals
|
|
140
173
|
};
|
|
141
174
|
|
|
142
175
|
function boot() {
|
|
143
|
-
|
|
176
|
+
observeLayoutShift();
|
|
177
|
+
send("page_view");
|
|
144
178
|
setTimeout(function () { signal(); }, 700);
|
|
145
179
|
}
|
|
146
180
|
|
|
147
|
-
if (d.readyState === "loading")
|
|
148
|
-
|
|
181
|
+
if (d.readyState === "loading") {
|
|
182
|
+
d.addEventListener("DOMContentLoaded", boot, { once: true });
|
|
183
|
+
} else {
|
|
184
|
+
boot();
|
|
185
|
+
}
|
|
149
186
|
})();
|
package/installer.js
CHANGED
|
@@ -356,6 +356,23 @@ This directory contains only the local install state and a server-side helper te
|
|
|
356
356
|
`;
|
|
357
357
|
}
|
|
358
358
|
|
|
359
|
+
function managedIgnoreTemplate(framework) {
|
|
360
|
+
const keepNote = framework === "static"
|
|
361
|
+
? "# runner.cjs and README.md stay committed so the scheduled workflow can run them.\n"
|
|
362
|
+
: "# site-agent.cjs and README.md stay committed for the website server runtime.\n";
|
|
363
|
+
return [
|
|
364
|
+
"# Written by @twin3-ai/agent-id install. Local runtime state stays out of git.",
|
|
365
|
+
keepNote.trimEnd(),
|
|
366
|
+
"install-state.json",
|
|
367
|
+
"install-commit.json",
|
|
368
|
+
"enterprise-state.json",
|
|
369
|
+
".transactions/",
|
|
370
|
+
"reports/",
|
|
371
|
+
"secrets/",
|
|
372
|
+
""
|
|
373
|
+
].join("\n");
|
|
374
|
+
}
|
|
375
|
+
|
|
359
376
|
function stateTemplate(plan) {
|
|
360
377
|
const state = {
|
|
361
378
|
schema: STATE_SCHEMA,
|
|
@@ -491,11 +508,13 @@ function buildInstallPlan({ url, projectRoot = process.cwd(), endpoint = DEFAULT
|
|
|
491
508
|
{ path: `${MANAGED_DIR}/install-state.json`, mode: "private", content: "" },
|
|
492
509
|
{ path: `${MANAGED_DIR}/runner.cjs`, mode: "customer_runner", content: staticRunnerTemplate(siteUrl, selection.modules) },
|
|
493
510
|
{ path: `${MANAGED_DIR}/README.md`, mode: "documentation", content: readmeTemplate(siteUrl, selectedFramework, selectedPackageManager, parentEndpoint) },
|
|
494
|
-
{ path: ".github/workflows/agent-id-sync.yml", mode: "customer_runner_workflow", content: staticWorkflowTemplate(siteUrl, parentEndpoint) }
|
|
511
|
+
{ path: ".github/workflows/agent-id-sync.yml", mode: "customer_runner_workflow", content: staticWorkflowTemplate(siteUrl, parentEndpoint) },
|
|
512
|
+
{ path: `${MANAGED_DIR}/.gitignore`, mode: "documentation", content: managedIgnoreTemplate(selectedFramework) }
|
|
495
513
|
] : [
|
|
496
514
|
{ path: `${MANAGED_DIR}/install-state.json`, mode: "private", content: "" },
|
|
497
515
|
{ path: `${MANAGED_DIR}/site-agent.cjs`, mode: "server_helper", content: runtimeTemplate() },
|
|
498
|
-
{ path: `${MANAGED_DIR}/README.md`, mode: "documentation", content: readmeTemplate(siteUrl, selectedFramework, selectedPackageManager, parentEndpoint) }
|
|
516
|
+
{ path: `${MANAGED_DIR}/README.md`, mode: "documentation", content: readmeTemplate(siteUrl, selectedFramework, selectedPackageManager, parentEndpoint) },
|
|
517
|
+
{ path: `${MANAGED_DIR}/.gitignore`, mode: "documentation", content: managedIgnoreTemplate(selectedFramework) }
|
|
499
518
|
];
|
|
500
519
|
const base = {
|
|
501
520
|
schema: INSTALL_SCHEMA,
|
|
@@ -553,7 +572,7 @@ function buildInstallPlan({ url, projectRoot = process.cwd(), endpoint = DEFAULT
|
|
|
553
572
|
|
|
554
573
|
function validatePlan(plan) {
|
|
555
574
|
if (!plan || plan.schema !== INSTALL_SCHEMA || plan.approval_required !== true) throw installError("INVALID_INSTALL_PLAN", "The installation plan is invalid or missing approval metadata.");
|
|
556
|
-
const expectedCount = plan.framework === "static" ?
|
|
575
|
+
const expectedCount = plan.framework === "static" ? 5 : 4;
|
|
557
576
|
if (!Array.isArray(plan.files) || plan.files.length !== expectedCount) throw installError("INVALID_INSTALL_PLAN", `The installation plan must contain exactly ${expectedCount} managed files.`);
|
|
558
577
|
const root = normalizeProjectRoot(plan.project_root);
|
|
559
578
|
for (const file of plan.files) {
|
|
@@ -873,6 +892,7 @@ function installContents(plan) {
|
|
|
873
892
|
[`${MANAGED_DIR}/site-agent.cjs`]: runtimeTemplate(),
|
|
874
893
|
[`${MANAGED_DIR}/runner.cjs`]: staticRunnerTemplate(plan.site_url, plan.modules),
|
|
875
894
|
[`${MANAGED_DIR}/README.md`]: readmeTemplate(plan.site_url, plan.framework, plan.package_manager, plan.parent_endpoint),
|
|
895
|
+
[`${MANAGED_DIR}/.gitignore`]: managedIgnoreTemplate(plan.framework),
|
|
876
896
|
".github/workflows/agent-id-sync.yml": staticWorkflowTemplate(plan.site_url)
|
|
877
897
|
}
|
|
878
898
|
};
|