@wenathlan/extension 1.1.65 → 1.1.66

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.
Files changed (46) hide show
  1. package/README.md +4 -3
  2. package/dist/attentionfeed.d.ts +74 -0
  3. package/dist/attentionfeed.d.ts.map +1 -0
  4. package/dist/backgroundruns.d.ts +71 -0
  5. package/dist/backgroundruns.d.ts.map +1 -0
  6. package/dist/flowlibrary.d.ts +147 -0
  7. package/dist/flowlibrary.d.ts.map +1 -0
  8. package/dist/index.d.ts +7 -1
  9. package/dist/index.d.ts.map +1 -1
  10. package/dist/index.js +686 -3
  11. package/dist/index.js.map +4 -4
  12. package/dist/memory.d.ts +67 -1
  13. package/dist/memory.d.ts.map +1 -1
  14. package/dist/outputcompare.d.ts +68 -0
  15. package/dist/outputcompare.d.ts.map +1 -0
  16. package/dist/policy.d.ts +63 -0
  17. package/dist/policy.d.ts.map +1 -1
  18. package/dist/protocol.d.ts +167 -0
  19. package/dist/protocol.d.ts.map +1 -1
  20. package/dist/runreplay.d.ts +53 -0
  21. package/dist/runreplay.d.ts.map +1 -0
  22. package/dist/surfaces.d.ts +2 -2
  23. package/dist/surfaces.d.ts.map +1 -1
  24. package/dist/syncbridge.d.ts +80 -0
  25. package/dist/syncbridge.d.ts.map +1 -0
  26. package/dist/types.d.ts +194 -3
  27. package/dist/types.d.ts.map +1 -1
  28. package/dist/version.d.ts +1 -1
  29. package/extension/dist/background.js +944 -6
  30. package/extension/dist/background.js.map +4 -4
  31. package/extension/dist/dashboardpage.html +2 -0
  32. package/extension/dist/dashboardpage.js +90 -0
  33. package/extension/dist/dashboardpage.js.map +2 -2
  34. package/extension/dist/manifest.json +1 -1
  35. package/extension/dist/optionspage.html +1 -0
  36. package/extension/dist/optionspage.js +73 -0
  37. package/extension/dist/optionspage.js.map +2 -2
  38. package/extension/dist/pagebridge.js.map +1 -1
  39. package/extension/dist/popup.html +1 -1
  40. package/extension/dist/popup.js +48 -36
  41. package/extension/dist/popup.js.map +2 -2
  42. package/extension/dist/sidepanel.html +1 -1
  43. package/extension/dist/sidepanel.js +135 -0
  44. package/extension/dist/sidepanel.js.map +2 -2
  45. package/extension/manifest.json +1 -1
  46. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -5321,6 +5321,111 @@ var sessionmemory = class {
5321
5321
  async addnotificationhistory(payload) {
5322
5322
  await this.adapter.set("notificationhistory", [payload, ...await this.getnotificationhistory()]);
5323
5323
  }
5324
+ /**
5325
+ * Ecosystem stores of the 1.1.66 family live here, scoped per profile workspace: the flowlibrary entries with their manifest digests and provenance, the library install and removal events, the syncbridge hooks with their conflict records, the attentionfeed entries with their configurable retention, the runreplay cursors per viewed run, the outputcompare sessions with their metric results and the background run queue state for restart recovery.
5326
+ * The flowlibrary store deduplicates entries by manifest digest, every entry carries its publisher provenance, and the manifest list exports for audit; the memory adapter seam stays the documented marketplace backend boundary because a future remote registry replaces the adapter only.
5327
+ */
5328
+ /** Returns every flowlibrary entry of the profile workspace, newest first. */
5329
+ async getflowlibrary() {
5330
+ return await this.adapter.get("flowlibrary") ?? [];
5331
+ }
5332
+ /** Replaces the flowlibrary entries of the profile workspace. */
5333
+ async setflowlibrary(entries) {
5334
+ return this.adapter.set("flowlibrary", entries);
5335
+ }
5336
+ /** Adds one flowlibrary entry deduplicated by manifest digest: an entry whose digest already exists replaces its predecessor while its provenance keeps both records. */
5337
+ async addlibraryentry(entry) {
5338
+ const entries = await this.getflowlibrary();
5339
+ const deduped = entries.filter((candidate) => candidate.digest !== entry.digest);
5340
+ await this.setflowlibrary([entry, ...deduped]);
5341
+ return [entry, ...deduped];
5342
+ }
5343
+ /** Removes one flowlibrary entry by its id while the library events keep their record for the audit trail. */
5344
+ async removelibraryentry(entryid) {
5345
+ await this.setflowlibrary((await this.getflowlibrary()).filter((candidate) => candidate.id !== entryid));
5346
+ }
5347
+ /** Returns every library install, update and removal event, newest first. */
5348
+ async getlibraryevents() {
5349
+ return await this.adapter.get("libraryevents") ?? [];
5350
+ }
5351
+ /** Records one library lifecycle event beside the flowlibrary store. */
5352
+ async addlibraryevent(event) {
5353
+ await this.adapter.set("libraryevents", [event, ...await this.getlibraryevents()]);
5354
+ }
5355
+ /** Exports the manifest list of the flowlibrary for audit: one row per entry with its digest, publisher, version, state and provenance and no step payload. */
5356
+ async exportlibrarymanifests() {
5357
+ return (await this.getflowlibrary()).map((entry) => ({ id: entry.id, title: entry.manifest.title, publisher: entry.manifest.publisher, version: entry.manifest.version, digest: entry.digest, state: entry.state, provenance: entry.provenance, addedat: entry.addedat }));
5358
+ }
5359
+ /** Returns every syncbridge hook of the profile workspace; every hook keeps its explicit opt in with no default on. */
5360
+ async getsyncbridgehooks() {
5361
+ return await this.adapter.get("syncbridgehooks") ?? [];
5362
+ }
5363
+ /** Replaces the syncbridge hooks of the profile workspace. */
5364
+ async setsyncbridgehooks(hooks) {
5365
+ return this.adapter.set("syncbridgehooks", hooks);
5366
+ }
5367
+ /** Returns every syncbridge conflict record, newest first, with both versions instead of a silent overwrite. */
5368
+ async getsyncbridgeconflicts() {
5369
+ return await this.adapter.get("syncbridgeconflicts") ?? [];
5370
+ }
5371
+ /** Records one syncbridge conflict with both manifest versions. */
5372
+ async addsyncbridgeconflict(conflict) {
5373
+ await this.adapter.set("syncbridgeconflicts", [conflict, ...await this.getsyncbridgeconflicts()]);
5374
+ }
5375
+ /** Resolves one syncbridge conflict by its id with the resolution the user picked; one conflict resolves exactly once. */
5376
+ async resolvesyncbridgeconflict(id, resolution, now) {
5377
+ const conflicts = await this.getsyncbridgeconflicts();
5378
+ await this.adapter.set("syncbridgeconflicts", conflicts.map((conflict) => conflict.id === id && conflict.resolution === void 0 ? { ...conflict, resolution, resolvedat: now } : conflict));
5379
+ return this.getsyncbridgeconflicts();
5380
+ }
5381
+ /** Returns every attentionfeed entry, newest first, with its cause, refs and deep link. */
5382
+ async getattentionentries() {
5383
+ return await this.adapter.get("attentionfeed") ?? [];
5384
+ }
5385
+ /** Records one attentionfeed entry deduplicated by its cause, run and gate refs while the retention window stays a user setting. */
5386
+ async addattentionentry(entry) {
5387
+ const existing = (await this.getattentionentries()).filter((candidate) => candidate.id !== entry.id);
5388
+ await this.adapter.set("attentionfeed", [entry, ...existing]);
5389
+ }
5390
+ /** Dismisses one attentionfeed entry by its id: the dismissal removes the feed row only while the waiting cause keeps its own resolution path. */
5391
+ async dismissattentionentry(id) {
5392
+ const entries = (await this.getattentionentries()).filter((candidate) => candidate.id !== id);
5393
+ await this.adapter.set("attentionfeed", entries);
5394
+ return entries;
5395
+ }
5396
+ /** Prunes the attentionfeed entries past their retention window; an absent window keeps every entry while the pruned ids return for the audit note. */
5397
+ async pruneattentionentries(now) {
5398
+ const retention = (await this.getsettings())?.attentionretention;
5399
+ const entries = await this.getattentionentries();
5400
+ if (retention === void 0) return { kept: entries, pruned: [] };
5401
+ const kept = entries.filter((entry) => now - entry.at < retention);
5402
+ await this.adapter.set("attentionfeed", kept);
5403
+ return { kept, pruned: entries.filter((entry) => now - entry.at >= retention).map((entry) => entry.id) };
5404
+ }
5405
+ /** Returns the runreplay cursors per viewed run so a reopened replay stands where the viewer left it. */
5406
+ async getreplaycursors() {
5407
+ return await this.adapter.get("replaycursors") ?? {};
5408
+ }
5409
+ /** Stores one runreplay cursor for its viewed run. */
5410
+ async setreplaycursor(runid, cursor) {
5411
+ await this.adapter.set("replaycursors", { ...await this.getreplaycursors(), [runid]: cursor });
5412
+ }
5413
+ /** Returns every outputcompare session with its metric results, newest first. */
5414
+ async getcomparesessions() {
5415
+ return await this.adapter.get("comparesessions") ?? [];
5416
+ }
5417
+ /** Records one outputcompare session with the metric set it used. */
5418
+ async addcomparesession(session) {
5419
+ await this.adapter.set("comparesessions", [session, ...await this.getcomparesessions()]);
5420
+ }
5421
+ /** Returns the background run queue state for restart recovery: every entry with its state and its keepalive hold. */
5422
+ async getbackgroundqueue() {
5423
+ return await this.adapter.get("backgroundqueue") ?? [];
5424
+ }
5425
+ /** Replaces the background run queue state after every transition so the restart recovery reads it in one call. */
5426
+ async setbackgroundqueue(queue) {
5427
+ return this.adapter.set("backgroundqueue", queue);
5428
+ }
5324
5429
  };
5325
5430
  function mediakindof(record2) {
5326
5431
  if ("pages" in record2) return "pdf";
@@ -11552,6 +11657,63 @@ function importexportgate(input) {
11552
11657
  if (input.unmaskedlogs) return { allowed: false, reason: "The importexport bundle carries unmasked log entries; only masked summaries ever move between profiles, so the bundle refuses in full." };
11553
11658
  return { allowed: true, reason: "The importexport bundle carries no secretvault value and no unmasked log; the originprofiles, the siteprofiles, the notes and the preferences move with their honest exclusion list." };
11554
11659
  }
11660
+ function librarymanifestgate(input) {
11661
+ if (input.errors.length > 0) return { allowed: false, reason: `The flowlibrary manifest fails schemastrict with ${input.errors.length} error${input.errors.length === 1 ? "" : "s"}: ${input.errors.slice(0, 3).map((error) => `${error.path} expected ${error.expected}`).join("; ")}; the import refuses before anything else.` };
11662
+ return { allowed: true, reason: "The flowlibrary manifest passes schemastrict with no shape error; the validation names every field it checked." };
11663
+ }
11664
+ function librarycapabilitygate(input) {
11665
+ const missing = [...new Set(input.kinds)].filter((kind) => !input.capabilities.includes(kind));
11666
+ if (missing.length > 0) return { allowed: false, reason: `The flowlibrary manifest uses the kind${missing.length === 1 ? "" : "s"} ${missing.join(", ")} the installed capability set lacks; the import refuses in full.` };
11667
+ return { allowed: true, reason: `Every kind of the flowlibrary manifest sits inside the installed capability set of ${input.capabilities.length} kind${input.capabilities.length === 1 ? "" : "s"}.` };
11668
+ }
11669
+ function librarygrantgate(input) {
11670
+ const missing = [...new Set(input.requiredgrants)].filter((origin) => !input.heldgrants.includes(origin));
11671
+ if (missing.length > 0) return { allowed: false, reason: `The flowlibrary manifest requires the grant${missing.length === 1 ? "" : "s"} ${missing.join(", ")} the profile does not hold; the grant diff shows them and the user grants them before the import completes.` };
11672
+ return { allowed: true, reason: `The profile holds every grant the flowlibrary manifest requires${input.requiredgrants.length === 0 ? " and the manifest requires none" : ""}.` };
11673
+ }
11674
+ function librarysensitivegate(input) {
11675
+ if (!input.sensitive) return { allowed: true, reason: "The flowlibrary manifest carries no sensitive mark, so no fresh consent prompt stands before its import." };
11676
+ if (!input.freshconsent) return { allowed: false, reason: "The flowlibrary manifest is marked sensitive; its import needs a fresh consent prompt the user answers before anything lands." };
11677
+ return { allowed: true, reason: "The user answered the fresh consent prompt of the sensitive flowlibrary manifest; the import proceeds behind the same review." };
11678
+ }
11679
+ function libraryquarantinegate(input) {
11680
+ if (!input.signaturepresent && !input.verified) return { allowed: false, reason: "The flowlibrary entry carries no publisher signature; the entry quarantines until the user verifies its publisher, and a quarantined entry never installs on its own." };
11681
+ if (input.signaturepresent && !input.signaturevalid) return { allowed: false, reason: "The publisher signature of the flowlibrary entry failed its verification; the entry quarantines and never installs under any flag." };
11682
+ return { allowed: true, reason: "The publisher signature of the flowlibrary entry verified over its manifest digest; the entry stays available for the grant diff and the import." };
11683
+ }
11684
+ function libraryimportgate(input) {
11685
+ if (!input.proposal) return { allowed: false, reason: "A library import lands as a proposal only; no template ever executes directly and the plan review gates every step as always." };
11686
+ if (!input.planreviewed) return { allowed: false, reason: "The library import proposal has no plan review yet; the plancards render and the user approves one step at a time before any execution." };
11687
+ return { allowed: true, reason: "The library import landed as a proposal and its plan passed the same review as every native task; the consent gates never moved." };
11688
+ }
11689
+ function syncbridgeoptingate(input) {
11690
+ if (!input.optin) return { allowed: false, reason: "The syncbridge hook stays off because no explicit opt in exists; no hook ever defaults on and no manifest moves without the user turning the hook on." };
11691
+ return { allowed: true, reason: "The user explicitly opted the syncbridge hook in; the hook moves manifests only and never secrets or logs." };
11692
+ }
11693
+ function syncbridgescopegate(input) {
11694
+ if (input.carriessecrets) return { allowed: false, reason: "The syncbridge payload carries a secretvault value shape; the bridge moves manifests only, so the payload refuses in full." };
11695
+ if (input.carrieslogs) return { allowed: false, reason: "The syncbridge payload carries log entries; the bridge moves manifests only, so the payload refuses in full." };
11696
+ return { allowed: true, reason: "The syncbridge payload carries manifests only; secrets and logs never ride the bridge under any flag." };
11697
+ }
11698
+ function runreplaygate(input) {
11699
+ if (!input.sealed) return { allowed: false, reason: "The runreplay walks sealed runs only; an open run keeps moving and its replay would show a chain that still grows." };
11700
+ if (!input.chainvalid) return { allowed: false, reason: "The sealed chain of the run failed its verification; the replay refuses the walk because only a verified chain stands as audit evidence." };
11701
+ return { allowed: true, reason: "The run sealed and its chain verified from the genesis hash to the seal; the replay walks it read only, restoring the observation and capture of each step." };
11702
+ }
11703
+ function outputcomparegate(input) {
11704
+ if (input.signaturea.trim() === "" || input.signatureb.trim() === "") return { allowed: false, reason: "The outputcompare needs the task input signature of both runs; a signatureless run never compares." };
11705
+ if (input.signaturea !== input.signatureb) return { allowed: false, reason: "The two runs carry different task input signatures; only runs that started from the same input compare their outcomes." };
11706
+ return { allowed: true, reason: "The two runs share their task input signature, so their step outcomes compare under the recorded metric set." };
11707
+ }
11708
+ function outputcomparereadonlygate(input) {
11709
+ if (input.executessteps) return { allowed: false, reason: "The outputcompare never executes a step; it reads the stored outcomes of both runs only, so any executing path refuses in full." };
11710
+ return { allowed: true, reason: "The outputcompare joins the stored outcomes of both runs without touching the page; no step executes inside a comparison." };
11711
+ }
11712
+ function backgroundrungate(input) {
11713
+ if (!input.reviewed) return { allowed: false, reason: "The background run queue executes reviewed workflows only; an unreviewed workflow never starts, with or without an open surface." };
11714
+ if (!input.keepaliveheld) return { allowed: false, reason: "A background run holds the keepalive signal for its whole duration; a run that releases the signal early stops being a background run." };
11715
+ return { allowed: true, reason: "The reviewed workflow runs in the background with the keepalive signal held and every checkpoint restoring it on each worker wake." };
11716
+ }
11555
11717
 
11556
11718
  // llm.ts
11557
11719
  var defaultrefusalmarkers = ["i cannot", "i can't", "i'm unable", "refusal:", "cannot comply"];
@@ -11912,7 +12074,7 @@ function budgetcheck(input) {
11912
12074
  }
11913
12075
 
11914
12076
  // version.ts
11915
- var packageversion = "1.1.65";
12077
+ var packageversion = "1.1.66";
11916
12078
 
11917
12079
  // types.ts
11918
12080
  var protocolversion = packageversion;
@@ -13483,7 +13645,8 @@ function onboardingsteps() {
13483
13645
  { id: "origingrants", surface: "popup", title: "Origin grants", body: "Devthink denies automation by default; grant one exact origin at a time from the popup and every run stays inside the granted origins.", completion: "origingrantscompleted" },
13484
13646
  { id: "planreview", surface: "sidepanel", title: "Plan review", body: "Every task becomes a plan of reviewed steps; read the plancards of each risk class and approve, reject or edit one step at a time.", completion: "planreviewcompleted" },
13485
13647
  { id: "runcontrol", surface: "sidepanel", title: "Run control", body: "Runs start, pause, resume and cancel under your hand; a cancelled run rolls only its queued steps back while the executed steps stay sealed.", completion: "runcontrolcompleted" },
13486
- { id: "logaudit", surface: "dashboardpage", title: "Log audit", body: "The immutable log chains every step transition with masked values; open the dashboard, verify the chain and copy a verified range as an audit excerpt.", completion: "logauditcompleted" }
13648
+ { id: "logaudit", surface: "dashboardpage", title: "Log audit", body: "The immutable log chains every step transition with masked values; open the dashboard, verify the chain and copy a verified range as an audit excerpt.", completion: "logauditcompleted" },
13649
+ { id: "library", surface: "dashboardpage", title: "Flow library", body: "The flowlibrary shares reviewed workflow templates: browse an entry, read its step list and grant diff, and every install still lands as a proposal behind the same review.", completion: "librarycompleted", optional: true }
13487
13650
  ];
13488
13651
  }
13489
13652
  function onboardingstart(previous, now) {
@@ -13494,7 +13657,7 @@ function onboardingcomplete(state, stepid, now) {
13494
13657
  const step = steps.find((candidate) => candidate.id === stepid);
13495
13658
  if (step === void 0) throw new Error(`The onboarding knows no ${stepid} step.`);
13496
13659
  const completed = state.stepscompleted.includes(stepid) ? state.stepscompleted : [...state.stepscompleted, stepid];
13497
- const done = steps.every((candidate) => completed.includes(candidate.id));
13660
+ const done = steps.filter((candidate) => candidate.optional !== true).every((candidate) => completed.includes(candidate.id));
13498
13661
  if (!done) return { state: { ...state, stepscompleted: completed, done: false } };
13499
13662
  const consentevent = "onboardingconsentgranted";
13500
13663
  return { state: { stepscompleted: completed, done: true, ...state.startedat !== void 0 ? { startedat: state.startedat } : {}, consentevent, completedat: now }, consentevent };
@@ -14085,6 +14248,445 @@ function a11ylabelslocalizedfor(surface, bundles, language) {
14085
14248
  return a11ylabelsfor(surface).map((label) => a11ylabellocalized(label, bundles, language));
14086
14249
  }
14087
14250
 
14251
+ // flowlibrary.ts
14252
+ async function sha2563(payload) {
14253
+ const bytes = new TextEncoder().encode(payload);
14254
+ const digest = await crypto.subtle.digest("SHA-256", bytes);
14255
+ return [...new Uint8Array(digest)].map((byte) => byte.toString(16).padStart(2, "0")).join("");
14256
+ }
14257
+ function manifestbody(manifest) {
14258
+ return JSON.stringify({ id: manifest.id, title: manifest.title, description: manifest.description, version: manifest.version, publisher: manifest.publisher, ...manifest.registry !== void 0 ? { registry: manifest.registry } : {}, steps: manifest.steps, kinds: manifest.kinds, requiredgrants: manifest.requiredgrants, dataexpectations: manifest.dataexpectations, sensitive: manifest.sensitive });
14259
+ }
14260
+ async function manifestdigest(manifest) {
14261
+ const { publish, ...body } = manifest;
14262
+ void publish;
14263
+ return sha2563(manifestbody(body));
14264
+ }
14265
+ async function validatemanifest(input) {
14266
+ const errors = [];
14267
+ const raw = input.manifest;
14268
+ if (!Boolean(raw) || typeof raw !== "object" || Array.isArray(raw)) return { ok: false, errors: [{ path: "manifest", expected: "object", found: Array.isArray(raw) ? "array" : typeof raw, reason: "Every flowlibrary manifest travels as one plain object." }], reason: "The flowlibrary manifest is no plain object; schemastrict refuses the carrier before any import." };
14269
+ const candidate = raw;
14270
+ if (typeof candidate.id !== "string" || candidate.id.trim() === "") errors.push({ path: "id", expected: "string", found: typeof candidate.id, reason: "The flowlibrary manifest needs its id." });
14271
+ if (typeof candidate.title !== "string" || candidate.title.trim() === "") errors.push({ path: "title", expected: "string", found: typeof candidate.title, reason: "The flowlibrary manifest needs its title." });
14272
+ if (typeof candidate.description !== "string") errors.push({ path: "description", expected: "string", found: typeof candidate.description, reason: "The flowlibrary manifest needs its description." });
14273
+ if (typeof candidate.version !== "string" || candidate.version.trim() === "") errors.push({ path: "version", expected: "string", found: typeof candidate.version, reason: "The flowlibrary manifest needs its version." });
14274
+ if (typeof candidate.publisher !== "string" || candidate.publisher.trim() === "") errors.push({ path: "publisher", expected: "string", found: typeof candidate.publisher, reason: "The flowlibrary manifest names its publisher." });
14275
+ if (!Array.isArray(candidate.steps) || candidate.steps.length === 0) errors.push({ path: "steps", expected: "array", found: Array.isArray(candidate.steps) ? "empty array" : typeof candidate.steps, reason: "The flowlibrary manifest declares its steps." });
14276
+ if (Array.isArray(candidate.steps)) {
14277
+ candidate.steps.forEach((step, index) => {
14278
+ const shape = step;
14279
+ if (!Boolean(shape) || typeof shape !== "object" || typeof shape.id !== "string" || shape.id.trim() === "" || typeof shape.kind !== "string" || shape.kind.trim() === "" || typeof shape.label !== "string") errors.push({ path: `steps.${index}`, expected: "flowlibrarystep", found: typeof step, reason: "Every flowlibrary step needs its id, kind and label." });
14280
+ });
14281
+ }
14282
+ if (!Array.isArray(candidate.kinds) || candidate.kinds.length === 0) errors.push({ path: "kinds", expected: "array", found: typeof candidate.kinds, reason: "The flowlibrary manifest declares the action kinds its steps use." });
14283
+ if (!Array.isArray(candidate.requiredgrants)) errors.push({ path: "requiredgrants", expected: "array", found: typeof candidate.requiredgrants, reason: "The flowlibrary manifest declares its required origin grants." });
14284
+ if (!Array.isArray(candidate.dataexpectations)) errors.push({ path: "dataexpectations", expected: "array", found: typeof candidate.dataexpectations, reason: "The flowlibrary manifest declares its data expectations with minimization hints." });
14285
+ if (typeof candidate.sensitive !== "boolean") errors.push({ path: "sensitive", expected: "boolean", found: typeof candidate.sensitive, reason: "The flowlibrary manifest marks whether it is sensitive." });
14286
+ const unknownfields = Object.keys(candidate).filter((key) => !["id", "title", "description", "version", "publisher", "registry", "steps", "kinds", "requiredgrants", "dataexpectations", "sensitive", "publish"].includes(key));
14287
+ for (const field of unknownfields) errors.push({ path: field, expected: "absent", found: "present", reason: `The flowlibrary manifest carries the unknown field ${field}; schemastrict refuses unknown fields.` });
14288
+ const schemagate = librarymanifestgate({ errors });
14289
+ if (!schemagate.allowed) return { ok: false, errors, reason: schemagate.reason ?? "The flowlibrary manifest fails schemastrict." };
14290
+ const manifest = { id: candidate.id, title: candidate.title, description: candidate.description, version: candidate.version, publisher: candidate.publisher, ...typeof candidate.registry === "string" && candidate.registry.trim() !== "" ? { registry: candidate.registry } : {}, steps: candidate.steps.map((step) => ({ id: step.id, kind: step.kind, label: step.label, ...step.target !== void 0 ? { target: step.target } : {}, ...step.value !== void 0 ? { value: step.value } : {}, ...step.namespace !== void 0 ? { namespace: step.namespace } : {} })), kinds: candidate.kinds, requiredgrants: candidate.requiredgrants, dataexpectations: candidate.dataexpectations, sensitive: candidate.sensitive, ...isPublish(candidate.publish) ? { publish: candidate.publish } : {} };
14291
+ const kinds = [...new Set(manifest.steps.map((step) => step.kind))];
14292
+ const capabilitygate = librarycapabilitygate({ kinds, capabilities: input.capabilities });
14293
+ if (!capabilitygate.allowed) return { ok: false, errors: [], reason: capabilitygate.reason ?? "", manifest };
14294
+ return { ok: true, errors: [], reason: `The manifest ${manifest.id} of ${manifest.publisher} validates under schemastrict with ${manifest.steps.length} step${manifest.steps.length === 1 ? "" : "s"} and ${kinds.length} kind${kinds.length === 1 ? "" : "s"} inside the installed capability set.`, manifest };
14295
+ }
14296
+ function isPublish(value) {
14297
+ if (!Boolean(value) || typeof value !== "object") return false;
14298
+ const shape = value;
14299
+ return typeof shape.publisher === "string" && shape.publisher.trim() !== "" && typeof shape.signature === "string" && shape.signature.trim() !== "" && typeof shape.digest === "string" && shape.digest.trim() !== "" && typeof shape.provenance === "string" && typeof shape.publishedat === "number";
14300
+ }
14301
+ async function verifypublishersignature(manifest) {
14302
+ if (manifest.publish === void 0) return { verified: false, reason: `The manifest ${manifest.id} of ${manifest.publisher} carries no publisher signature; the entry quarantines until the user verifies its publisher.` };
14303
+ const digest = await manifestdigest(manifest);
14304
+ if (manifest.publish.digest !== digest) return { verified: false, reason: `The publisher signature of ${manifest.publish.publisher} covers the digest ${manifest.publish.digest} while the manifest body hashes to ${digest}; the verification refuses the signature in full.` };
14305
+ if (manifest.publish.publisher !== manifest.publisher) return { verified: false, reason: `The publisher signature names ${manifest.publish.publisher} while the manifest carries the publisher ${manifest.publisher}; the verification refuses the signature in full.` };
14306
+ const seal = await sha2563(`${manifest.publish.publisher}
14307
+ ${manifest.publish.digest}
14308
+ ${manifest.publish.provenance}`);
14309
+ if (manifest.publish.signature !== seal) return { verified: false, reason: `The publisher signature of ${manifest.publish.publisher} seals neither the manifest digest nor its provenance; the verification refuses the signature in full.` };
14310
+ return { verified: true, reason: `The publisher signature of ${manifest.publish.publisher} verifies over the manifest digest ${digest.slice(0, 12)}\u2026 with its provenance ${manifest.publish.provenance}.` };
14311
+ }
14312
+ async function signmanifest(manifest, provenance, publishedat) {
14313
+ const digest = await manifestdigest(manifest);
14314
+ return { publisher: manifest.publisher, signature: await sha2563(`${manifest.publisher}
14315
+ ${digest}
14316
+ ${provenance}`), digest, provenance, publishedat };
14317
+ }
14318
+ async function libraryentryof(input) {
14319
+ const digest = await manifestdigest(input.manifest);
14320
+ const verification = await verifypublishersignature(input.manifest);
14321
+ const quarantinegate = libraryquarantinegate({ verified: verification.verified, signaturepresent: input.manifest.publish !== void 0, signaturevalid: verification.verified });
14322
+ const state = quarantinegate.allowed ? "available" : "quarantined";
14323
+ return { id: `${input.manifest.id}@${input.manifest.version}`, manifest: input.manifest, digest, state, provenance: `${input.provenance}; ${verification.reason}`, addedat: input.now };
14324
+ }
14325
+ function grantdiffof(input) {
14326
+ const required = [...new Set(input.manifest.requiredgrants)];
14327
+ const added = required.filter((origin) => !input.heldgrants.includes(origin));
14328
+ const kept = required.filter((origin) => input.heldgrants.includes(origin));
14329
+ const originmappings = required.map((origin) => ({ origin, kinds: [...new Set(input.manifest.steps.map((step) => step.kind))] }));
14330
+ return { added, kept, originmappings };
14331
+ }
14332
+ function sensitiveconsentfor(manifest, freshconsent) {
14333
+ const gate = librarysensitivegate({ sensitive: manifest.sensitive, freshconsent });
14334
+ return { required: manifest.sensitive, reason: gate.reason ?? "" };
14335
+ }
14336
+ function libraryproposalof(entry) {
14337
+ const gate = libraryimportgate({ proposal: true, planreviewed: true });
14338
+ return { objective: `Install the flowlibrary template ${entry.manifest.title} version ${entry.manifest.version} of ${entry.manifest.publisher} with ${entry.manifest.steps.length} steps and ${entry.manifest.requiredgrants.length} required grant${entry.manifest.requiredgrants.length === 1 ? "" : "s"}.`, reviewed: true, reason: gate.reason ?? "" };
14339
+ }
14340
+ function manifestrisk(manifest) {
14341
+ let risk = "read";
14342
+ for (const step of manifest.steps) {
14343
+ const candidate = actionrisk(step.kind);
14344
+ if (candidate === "sensitive") return "sensitive";
14345
+ if (candidate === "interaction") risk = "interaction";
14346
+ }
14347
+ return risk;
14348
+ }
14349
+ function installlibrary(input) {
14350
+ const manifest = input.entry.manifest;
14351
+ const prefix = input.selectornamespace?.trim() ?? "";
14352
+ const steps = manifest.steps.map((step) => ({
14353
+ id: `${manifest.id}-${step.id}`,
14354
+ kind: step.kind,
14355
+ label: step.label,
14356
+ ...step.target !== void 0 ? { target: prefix === "" ? step.target : `${prefix} ${step.target}`.trim() } : {},
14357
+ ...step.value !== void 0 ? { value: step.value } : {}
14358
+ }));
14359
+ return { id: `library:${manifest.id}:${manifest.version}`, name: manifest.title, version: 1, origins: [...new Set(manifest.requiredgrants)], steps, blocks: [], risk: manifestrisk(manifest), reviewstate: "pending", createdat: input.now };
14360
+ }
14361
+ function updatelibrary(input) {
14362
+ if (input.incoming.digest === input.existing.digest) return { changedsteps: [], addedgrants: [], versionfrom: input.existing.manifest.version, versionto: input.incoming.manifest.version, replace: false, reason: `The incoming ${input.incoming.manifest.id} carries the same manifest digest as the installed entry; the update replaces nothing.` };
14363
+ const existingsteps = new Set(input.existing.manifest.steps.map((step) => step.id));
14364
+ const incomingsteps = new Set(input.incoming.manifest.steps.map((step) => step.id));
14365
+ const changedsteps = [.../* @__PURE__ */ new Set([...existingsteps, ...incomingsteps])].filter((id) => {
14366
+ const before = input.existing.manifest.steps.find((step) => step.id === id);
14367
+ const after = input.incoming.manifest.steps.find((step) => step.id === id);
14368
+ return before === void 0 || after === void 0 || before.kind !== after.kind || before.target !== after.target || before.value !== after.value;
14369
+ });
14370
+ const addedgrants = [...new Set(input.incoming.manifest.requiredgrants)].filter((origin) => !input.existing.manifest.requiredgrants.includes(origin));
14371
+ return { changedsteps, addedgrants, versionfrom: input.existing.manifest.version, versionto: input.incoming.manifest.version, replace: true, reason: `The update of ${input.incoming.manifest.id} from version ${input.existing.manifest.version} to ${input.incoming.manifest.version} changes ${changedsteps.length} step${changedsteps.length === 1 ? "" : "s"} and adds ${addedgrants.length} grant${addedgrants.length === 1 ? "" : "s"}; the version diff surfaces before the replace.` };
14372
+ }
14373
+ function removelibrary(input) {
14374
+ return { removed: input.entry.id, keptforks: input.forks.map((fork) => fork.id), reason: `The library entry ${input.entry.manifest.title} leaves the store while its ${input.forks.length} local fork${input.forks.length === 1 ? "" : "s"} stay untouched; a fork is an independent local workflow.` };
14375
+ }
14376
+ function forklibrary(input) {
14377
+ const manifest = input.entry.manifest;
14378
+ const steps = manifest.steps.map((step) => ({ id: `fork-${step.id}`, kind: step.kind, label: step.label, ...step.target !== void 0 ? { target: step.target } : {}, ...step.value !== void 0 ? { value: step.value } : {} }));
14379
+ return { id: `fork:${manifest.id}:${input.now}`, name: `${manifest.title} fork`, version: 1, origins: [...new Set(manifest.requiredgrants)], steps, blocks: [], risk: manifestrisk(manifest), reviewstate: "pending", createdat: input.now };
14380
+ }
14381
+ function librarysearch(input) {
14382
+ const query = input.query?.trim().toLowerCase() ?? "";
14383
+ return input.entries.filter((entry) => {
14384
+ if (input.filter?.publisher !== void 0 && entry.manifest.publisher !== input.filter.publisher) return false;
14385
+ if (input.filter?.sensitive !== void 0 && entry.manifest.sensitive !== input.filter.sensitive) return false;
14386
+ if (input.filter?.state !== void 0 && entry.state !== input.filter.state) return false;
14387
+ if (query === "") return true;
14388
+ return [entry.manifest.title, entry.manifest.description, entry.manifest.publisher].some((text2) => text2.toLowerCase().includes(query));
14389
+ });
14390
+ }
14391
+ function librarybrowserow(entry) {
14392
+ return { id: entry.id, title: entry.manifest.title, publisher: entry.manifest.publisher, version: entry.manifest.version, grants: entry.manifest.requiredgrants, sensitive: entry.manifest.sensitive, state: entry.state, ...entry.manifest.registry !== void 0 ? { registry: entry.manifest.registry } : {} };
14393
+ }
14394
+ function librarystepsview(entry) {
14395
+ return entry.manifest.steps.map((step) => {
14396
+ const expectations = entry.manifest.dataexpectations.filter((expectation) => expectation.stepid === step.id);
14397
+ return { id: step.id, kind: step.kind, label: step.label, ...step.target !== void 0 ? { target: step.target } : {}, ...step.namespace !== void 0 ? { namespace: step.namespace } : {}, families: expectations.map((expectation) => expectation.family), fields: [...new Set(expectations.flatMap((expectation) => expectation.fields))] };
14398
+ });
14399
+ }
14400
+ function dataexpectationssummary(manifest) {
14401
+ const families = /* @__PURE__ */ new Map();
14402
+ for (const expectation of manifest.dataexpectations) {
14403
+ const entry = families.get(expectation.family) ?? { fields: /* @__PURE__ */ new Set(), steps: /* @__PURE__ */ new Set() };
14404
+ for (const field of expectation.fields) entry.fields.add(field);
14405
+ entry.steps.add(expectation.stepid);
14406
+ families.set(expectation.family, entry);
14407
+ }
14408
+ return [...families.entries()].map(([family, entry]) => ({ family, fields: [...entry.fields], steps: [...entry.steps] }));
14409
+ }
14410
+ function libraryeventof(input) {
14411
+ if (input.entryid.trim() === "") throw new Error("The library event needs its entry id.");
14412
+ return { id: `libraryevent:${input.kind}:${input.entryid}:${input.now}`, kind: input.kind, entryid: input.entryid, title: input.title, version: input.version, detail: input.detail, at: input.now };
14413
+ }
14414
+ function exportlibrarymanifests(entries) {
14415
+ return entries.map((entry) => ({ id: entry.id, title: entry.manifest.title, publisher: entry.manifest.publisher, version: entry.manifest.version, digest: entry.digest, state: entry.state, provenance: entry.provenance, addedat: entry.addedat }));
14416
+ }
14417
+
14418
+ // syncbridge.ts
14419
+ async function sha2564(payload) {
14420
+ const bytes = new TextEncoder().encode(payload);
14421
+ const digest = await crypto.subtle.digest("SHA-256", bytes);
14422
+ return [...new Uint8Array(digest)].map((byte) => byte.toString(16).padStart(2, "0")).join("");
14423
+ }
14424
+ async function syncdigestof(manifest) {
14425
+ const { publish, ...body } = manifest;
14426
+ void publish;
14427
+ return sha2564(JSON.stringify(body));
14428
+ }
14429
+ function syncbridgehookof(input) {
14430
+ if (input.endpoint.trim() === "") throw new Error(`The ${input.provider} hook needs its user configured endpoint; no provider address is ever hardcoded.`);
14431
+ const gate = syncbridgeoptingate({ optin: false });
14432
+ if (gate.allowed) throw new Error("The syncbridge hook never starts with its opt in on; no hook ever defaults on.");
14433
+ return { id: `sync:${input.provider}:${input.now}`, provider: input.provider, direction: input.direction, optin: false, endpoint: input.endpoint.trim(), state: "idle", createdat: input.now };
14434
+ }
14435
+ function syncbridgeoptinflip(hook, optin) {
14436
+ return { ...hook, optin, state: "idle" };
14437
+ }
14438
+ function syncbridgeproviders() {
14439
+ return [
14440
+ { provider: "file", label: "File provider", operations: ["pull", "push", "list"], note: "The file provider moves manifests through manual import and export files the user picks; the bridge carries no secret and no log entry under any flag." },
14441
+ { provider: "web", label: "Web provider stub", operations: ["pull", "push", "list"], note: "The web provider stays a stub behind its opt in gate: the endpoint stays the user's configured registry value and no network call ships before the ecosystem part two backend exists." }
14442
+ ];
14443
+ }
14444
+ async function syncbridgeexportpayload(manifests) {
14445
+ const digests = [];
14446
+ for (const manifest of manifests) digests.push(await syncdigestof(manifest));
14447
+ return { version: 1, kind: "syncbridge", manifests, digests, exclusions: ["secretvault values", "logs"] };
14448
+ }
14449
+ function syncbridgevalidate(payload) {
14450
+ const carriessecrets = payload.secrets !== void 0 || Array.isArray(payload.manifests) && payload.manifests.some((manifest) => secretcarrying2(manifest));
14451
+ const gate = syncbridgescopegate({ carriessecrets, carrieslogs: payload.logs !== void 0 });
14452
+ if (!gate.allowed) return { ok: false, reason: gate.reason ?? "The syncbridge payload refuses." };
14453
+ if (payload.kind !== "syncbridge") return { ok: false, reason: "The syncbridge payload names its kind; a foreign payload never imports." };
14454
+ if (!Array.isArray(payload.manifests)) return { ok: false, reason: "The syncbridge payload carries its manifest list." };
14455
+ return { ok: true, reason: `The syncbridge payload carries ${payload.manifests.length} manifest${payload.manifests.length === 1 ? "" : "s"} and no secret and no log entry; the bridge moves manifests only.` };
14456
+ }
14457
+ function secretcarrying2(record2) {
14458
+ if (record2 === null || typeof record2 !== "object") return false;
14459
+ const entries = Object.entries(record2);
14460
+ const secretkeys = ["secret", "token", "password", "apikey", "authorization"];
14461
+ return entries.some(([key, value]) => secretkeys.some((shape) => key.toLowerCase().includes(shape)) && typeof value === "string" && value.trim() !== "");
14462
+ }
14463
+ async function syncbridgescan(input) {
14464
+ const gate = syncbridgeoptingate({ optin: input.hook.optin });
14465
+ if (!gate.allowed) return { conflicts: [], synced: [], reason: gate.reason ?? "" };
14466
+ const conflicts = [];
14467
+ const synced = [];
14468
+ for (const remotemanifest of input.remote) {
14469
+ const localmanifest = input.local.find((candidate) => candidate.manifestid === remotemanifest.manifestid);
14470
+ if (localmanifest === void 0) {
14471
+ synced.push(remotemanifest.manifestid);
14472
+ continue;
14473
+ }
14474
+ if (localmanifest.digest === remotemanifest.digest) {
14475
+ synced.push(remotemanifest.manifestid);
14476
+ continue;
14477
+ }
14478
+ conflicts.push({ id: `conflict:${remotemanifest.manifestid}:${input.now}`, hookid: input.hook.id, manifestid: remotemanifest.manifestid, local: { digest: localmanifest.digest, version: localmanifest.version }, remote: { digest: remotemanifest.digest, version: remotemanifest.version }, detectedat: input.now });
14479
+ }
14480
+ return { conflicts, synced, reason: `The ${input.hook.provider} hook of ${input.hook.endpoint} scanned ${input.remote.length} remote manifest${input.remote.length === 1 ? "" : "s"} against ${input.local.length} local entr${input.local.length === 1 ? "y" : "ies"}: ${synced.length} moved while ${conflicts.length} conflict${conflicts.length === 1 ? "" : "s"} surfaced both versions instead of a silent overwrite.` };
14481
+ }
14482
+ function resolveconflict(conflict, resolution, now) {
14483
+ if (conflict.resolution !== void 0) throw new Error(`The conflict ${conflict.id} already resolved at ${conflict.resolvedat}; one conflict resolves exactly once.`);
14484
+ return { ...conflict, resolution, resolvedat: now };
14485
+ }
14486
+ function conflictsfor(conflicts, hookid) {
14487
+ return hookid === void 0 ? conflicts : conflicts.filter((conflict) => conflict.hookid === hookid);
14488
+ }
14489
+ function webproviderstub(hook) {
14490
+ const gate = syncbridgeoptingate({ optin: hook.optin });
14491
+ return { hookid: hook.id, endpoint: hook.endpoint, optin: hook.optin, operations: ["pull", "push", "list"], stub: true, reason: gate.allowed ? `The web provider of ${hook.endpoint} stays a stub behind its explicit opt in; the ecosystem part two backend brings its network path.` : gate.reason ?? "" };
14492
+ }
14493
+ function fileproviderof(hook) {
14494
+ return { hookid: hook.id, operations: [{ kind: "pull", label: "Pull the manifests of one dropped syncbridge file" }, { kind: "push", label: "Push the local manifests into one export file" }, { kind: "list", label: "List the manifests the hook carries" }] };
14495
+ }
14496
+
14497
+ // attentionfeed.ts
14498
+ function attentionseverityof(cause) {
14499
+ if (cause === "gatewait" || cause === "phishguard") return "critical";
14500
+ if (cause === "deferral") return "warning";
14501
+ return "info";
14502
+ }
14503
+ function attentiondeeplinkof(cause, runid, gateref) {
14504
+ if (cause === "gatewait") return `devthink://gate/${encodeURIComponent(gateref ?? "unknown")}?run=${encodeURIComponent(runid)}`;
14505
+ if (cause === "phishguard") return `devthink://phishguard?run=${encodeURIComponent(runid)}`;
14506
+ if (cause === "deferral") return `devthink://deferred?run=${encodeURIComponent(runid)}`;
14507
+ return `devthink://error?run=${encodeURIComponent(runid)}`;
14508
+ }
14509
+ function attentionentryof(input) {
14510
+ if (input.runid.trim() === "") throw new Error("The attention entry needs its run ref.");
14511
+ if (input.summary.trim() === "") throw new Error("The attention entry needs its summary in plain language.");
14512
+ return { id: `attention:${input.cause}:${input.runid}:${input.gateref ?? "none"}`, cause: input.cause, severity: attentionseverityof(input.cause), runid: input.runid, ...input.gateref !== void 0 && input.gateref.trim() !== "" ? { gateref: input.gateref } : {}, origin: input.origin, summary: input.summary, deeplink: attentiondeeplinkof(input.cause, input.runid, input.gateref), at: input.at };
14513
+ }
14514
+ function collectattention(input) {
14515
+ const entries = [];
14516
+ for (const wait of input.gatewaits ?? []) entries.push(attentionentryof({ cause: "gatewait", runid: wait.runid, origin: wait.origin, summary: `The ${wait.kind} gate of the step ${wait.stepid} waits ${wait.waitedms} milliseconds for one human action.`, gateref: wait.gateid, at: input.now }));
14517
+ for (const block of input.phishblocks ?? []) entries.push(attentionentryof({ cause: "phishguard", runid: block.runid, origin: block.origin, summary: `The phishguard blocked a credential step on ${block.origin} that resembles the granted ${block.matchedorigin}: ${block.reason}`, at: input.now }));
14518
+ for (const deferral of input.deferrals ?? []) entries.push(attentionentryof({ cause: "deferral", runid: deferral.runid, origin: deferral.origin, summary: `A command deferred past its rate window on ${deferral.origin}: ${deferral.reason}`, at: input.now }));
14519
+ for (const failure of input.failures ?? []) entries.push(attentionentryof({ cause: "failure", runid: failure.runid, origin: failure.origin, summary: `The step ${failure.stepid} failed: ${failure.message}`, at: input.now }));
14520
+ return entries;
14521
+ }
14522
+ function dedupeattention(entries) {
14523
+ const seen = /* @__PURE__ */ new Set();
14524
+ const kept = [];
14525
+ for (const entry of [...entries].sort((a, b) => a.at - b.at)) {
14526
+ const key = `${entry.cause}:${entry.runid}:${entry.gateref ?? "none"}`;
14527
+ if (seen.has(key)) continue;
14528
+ seen.add(key);
14529
+ kept.push(entry);
14530
+ }
14531
+ return kept;
14532
+ }
14533
+ function rankattention(entries) {
14534
+ const order = { critical: 0, warning: 1, info: 2 };
14535
+ return [...entries].sort((a, b) => order[a.severity] - order[b.severity] || b.at - a.at);
14536
+ }
14537
+ function attentioncountof(entries) {
14538
+ return rankattention(dedupeattention(entries)).length;
14539
+ }
14540
+ function dismissattention(entries, id) {
14541
+ return entries.filter((entry) => entry.id !== id);
14542
+ }
14543
+ function pruneattention(entries, retention, now) {
14544
+ if (retention === void 0) return { kept: entries, pruned: [] };
14545
+ const kept = entries.filter((entry) => now - entry.at < retention);
14546
+ return { kept, pruned: entries.filter((entry) => now - entry.at >= retention).map((entry) => entry.id) };
14547
+ }
14548
+ function attentionnotifications(entries, now) {
14549
+ return rankattention(dedupeattention(entries)).map((entry) => ({ id: `notify:${entry.id}`, kind: "attention", title: entry.cause === "gatewait" ? "A gate waits for you" : entry.cause === "phishguard" ? "The phishguard blocked a step" : entry.cause === "deferral" ? "A command deferred" : "A step failed", body: entry.summary, deeplink: entry.deeplink, runid: entry.runid, ...entry.gateref !== void 0 ? { stepid: entry.gateref } : {}, content: false, at: now }));
14550
+ }
14551
+
14552
+ // backgroundruns.ts
14553
+ function backgroundqueueentryof(input) {
14554
+ if (input.workflowid.trim() === "") throw new Error("The background queue entry needs its workflow id.");
14555
+ return { id: `background:${input.workflowid}:${input.now}`, workflowid: input.workflowid, state: "queued", keepaliveheld: false, queuedat: input.now, summary: input.summary };
14556
+ }
14557
+ function enqueuebackgroundrun(input) {
14558
+ return [...input.queue, backgroundqueueentryof({ workflowid: input.workflowid, summary: input.summary, now: input.now })];
14559
+ }
14560
+ function nextbackgroundrun(queue) {
14561
+ return [...queue].filter((entry) => entry.state === "queued").sort((a, b) => a.queuedat - b.queuedat)[0];
14562
+ }
14563
+ function beginbackgroundrun(entry, now, reviewed) {
14564
+ const gate = backgroundrungate({ reviewed, keepaliveheld: true });
14565
+ return { entry: gate.allowed ? { ...entry, state: "running", keepaliveheld: true, startedat: now } : entry, gate: { allowed: gate.allowed, reason: gate.reason ?? "" } };
14566
+ }
14567
+ function finishbackgroundrun(entry, state, now) {
14568
+ return { ...entry, state, keepaliveheld: false, endedat: now };
14569
+ }
14570
+ function resumebackgroundqueue(queue, now) {
14571
+ const requeued = [];
14572
+ const next = queue.map((entry) => {
14573
+ if (entry.state !== "running") return entry;
14574
+ requeued.push(entry.id);
14575
+ const { startedat, ...rest } = entry;
14576
+ void startedat;
14577
+ return { ...rest, state: "queued", keepaliveheld: false };
14578
+ });
14579
+ void now;
14580
+ return { queue: next, requeued };
14581
+ }
14582
+ function backgroundrunattention(entry, origin) {
14583
+ if (entry.state === "failed") return { cause: "failure", runid: entry.id, origin, summary: `The background run of ${entry.workflowid} failed: ${entry.summary}` };
14584
+ if (entry.state === "queued") return { cause: "deferral", runid: entry.id, origin, summary: `The background run of ${entry.workflowid} waits for its executor turn.` };
14585
+ return void 0;
14586
+ }
14587
+ function backgroundrunsview(queue) {
14588
+ return queue.map((entry) => ({ id: entry.id, workflowid: entry.workflowid, state: entry.state, keepaliveheld: entry.keepaliveheld, queuedat: entry.queuedat, ...entry.startedat !== void 0 ? { startedat: entry.startedat } : {}, ...entry.endedat !== void 0 ? { endedat: entry.endedat } : {}, summary: entry.summary, progress: entry.state === "running" ? `Running with the keepalive signal held since ${entry.startedat ?? entry.queuedat}` : entry.state === "queued" ? "Queued for the next executor turn" : entry.state === "done" ? "Completed in the background" : "Failed; the attentionfeed carries the cause" }));
14589
+ }
14590
+ function backgroundtrayrows(queue, origin) {
14591
+ return queue.filter((entry) => entry.state === "done" || entry.state === "failed").map((entry) => ({ runid: entry.id, origin, outcome: entry.state === "done" ? "completed" : "failed", title: `Background run of ${entry.workflowid}`, at: entry.endedat ?? entry.queuedat, resumable: false, reopenable: true }));
14592
+ }
14593
+ function cancelbackgroundentry(queue, id) {
14594
+ const cancelled = [];
14595
+ const next = queue.filter((entry) => {
14596
+ if (entry.id === id && entry.state === "queued") {
14597
+ cancelled.push(entry.id);
14598
+ return false;
14599
+ }
14600
+ return true;
14601
+ });
14602
+ return { queue: next, cancelled };
14603
+ }
14604
+
14605
+ // runreplay.ts
14606
+ function restoredrefsof(entry) {
14607
+ const observation = /observation (\d+)/i.exec(entry.summary);
14608
+ const capture = /capture ([a-z0-9-]+)/i.exec(entry.summary);
14609
+ return { ...observation !== null ? { observationversion: Number(observation[1]) } : {}, ...capture !== null ? { captureid: capture[1] } : {} };
14610
+ }
14611
+ function replaystepof(entry, index, gates) {
14612
+ const refs = restoredrefsof(entry);
14613
+ return { stepid: entry.stepid ?? entry.id, index, summary: entry.summary, ...refs.observationversion !== void 0 ? { observationversion: refs.observationversion } : {}, ...refs.captureid !== void 0 ? { captureid: refs.captureid } : {}, gateresolutions: entry.stepid === void 0 ? [] : gates.filter((gate) => gate.gateid === entry.stepid) };
14614
+ }
14615
+ function runreplaysessionof(input) {
14616
+ if (input.runid.trim() === "") throw new Error("The runreplay session needs its recorded run id.");
14617
+ if (input.entries.length === 0) throw new Error("The runreplay session needs at least one verified log entry to walk.");
14618
+ const steps = input.entries.map((entry, index) => replaystepof(entry, index, input.gates ?? []));
14619
+ return { id: `replay:${input.runid}:${input.now}`, runid: input.runid, cursor: 0, playing: false, steps, openedat: input.now, actions: [] };
14620
+ }
14621
+ function replaymove(session, direction, now) {
14622
+ const next = direction === "forward" ? Math.min(session.steps.length - 1, session.cursor + 1) : Math.max(0, session.cursor - 1);
14623
+ const step = session.steps[next];
14624
+ return { ...session, cursor: next, playing: false, actions: [...session.actions, { kind: "step", at: now, ...step !== void 0 ? { stepid: step.stepid } : {} }] };
14625
+ }
14626
+ function replayjump(session, stepid, now) {
14627
+ const index = session.steps.findIndex((step) => step.stepid === stepid);
14628
+ if (index === -1) throw new Error(`The runreplay knows no ${stepid} step in the recorded chain of ${session.runid}.`);
14629
+ return { ...session, cursor: index, playing: false, actions: [...session.actions, { kind: "jump", stepid, at: now }] };
14630
+ }
14631
+ function replayplay(session, playing, now) {
14632
+ return { ...session, playing, actions: [...session.actions, { kind: playing ? "play" : "pause", at: now }] };
14633
+ }
14634
+ function replayviewaction(session, action) {
14635
+ return { ...session, actions: [...session.actions, { kind: action.kind, ...action.stepid !== void 0 ? { stepid: action.stepid } : {}, at: action.at }] };
14636
+ }
14637
+ function replayrestoredview(step) {
14638
+ return { stepid: step.stepid, index: step.index, summary: step.summary, ...step.observationversion !== void 0 ? { observationversion: step.observationversion } : {}, ...step.captureid !== void 0 ? { captureid: step.captureid } : {}, gateresolutions: step.gateresolutions };
14639
+ }
14640
+ function replaycursorof(session) {
14641
+ return { runid: session.runid, cursor: session.cursor, playing: session.playing };
14642
+ }
14643
+
14644
+ // outputcompare.ts
14645
+ function taskinputsignatureof(input) {
14646
+ return `${input.objective.trim()}|${input.steps.length}|${input.steps.join(",")}`;
14647
+ }
14648
+ function comparemetricdefaults() {
14649
+ return ["agreement", "divergence", "durationdelta"];
14650
+ }
14651
+ function joinruns(logsa, logsb) {
14652
+ const sequence = [];
14653
+ for (const entry of logsa) if (!sequence.includes(entry.stepid)) sequence.push(entry.stepid);
14654
+ for (const entry of logsb) if (!sequence.includes(entry.stepid)) sequence.push(entry.stepid);
14655
+ return sequence.map((stepid, index) => {
14656
+ const a = logsa.find((entry) => entry.stepid === stepid);
14657
+ const b = logsb.find((entry) => entry.stepid === stepid);
14658
+ return { stepid, index, ...a !== void 0 ? { a } : {}, ...b !== void 0 ? { b } : {} };
14659
+ });
14660
+ }
14661
+ function stepcomparisonof(pair) {
14662
+ const a = pair.a;
14663
+ const b = pair.b;
14664
+ if (a === void 0 || b === void 0) return { stepid: pair.stepid, index: pair.index, agreement: "onlyone", summarya: a?.summary ?? "", summaryb: b?.summary ?? "", durationdelta: 0 };
14665
+ const agree = a.state === b.state && a.summary === b.summary;
14666
+ return { stepid: pair.stepid, index: pair.index, agreement: agree ? "agree" : "diverge", summarya: a.summary, summaryb: b.summary, durationdelta: a.duration - b.duration };
14667
+ }
14668
+ function firstdivergenceof(steps) {
14669
+ const divergent = steps.find((step) => step.agreement !== "agree");
14670
+ return divergent === void 0 ? void 0 : divergent.index;
14671
+ }
14672
+ function outputcomparesessionof(input) {
14673
+ if (input.runids[0].trim() === "" || input.runids[1].trim() === "") throw new Error("The outputcompare session needs both run ids.");
14674
+ if (input.runids[0] === input.runids[1]) throw new Error("The outputcompare session compares two distinct runs; one run never stands beside itself.");
14675
+ const metrics = input.metrics ?? comparemetricdefaults();
14676
+ const steps = joinruns(input.logsa, input.logsb).map((pair) => stepcomparisonof(pair));
14677
+ const firstdivergence = firstdivergenceof(steps);
14678
+ return { id: `compare:${input.runids[0]}:${input.runids[1]}:${input.now}`, runids: input.runids, metrics, steps, ...firstdivergence !== void 0 ? { firstdivergence } : {}, openedat: input.now };
14679
+ }
14680
+ function comparesessionmetrics(session) {
14681
+ const agree = session.steps.filter((step) => step.agreement === "agree").length;
14682
+ const diverge = session.steps.filter((step) => step.agreement === "diverge").length;
14683
+ const onlyone = session.steps.filter((step) => step.agreement === "onlyone").length;
14684
+ return { metrics: session.metrics, agree, diverge, onlyone, ...session.firstdivergence !== void 0 ? { firstdivergence: session.firstdivergence } : {}, reason: `The comparison of ${session.runids[0]} and ${session.runids[1]} graded ${agree} agreeing, ${diverge} divergent and ${onlyone} single run step${agree + diverge + onlyone === 1 ? "" : "s"} under the metric set ${session.metrics.join(", ")}${session.firstdivergence !== void 0 ? ` with the first divergence at step index ${session.firstdivergence}` : " with agreement across the whole sequence"}.` };
14685
+ }
14686
+ function outputcompareview(session) {
14687
+ return session.steps.map((step) => ({ stepid: step.stepid, index: step.index, agreement: step.agreement, summarya: step.summarya, summaryb: step.summaryb, durationdelta: step.durationdelta, highlighted: session.firstdivergence !== void 0 && step.index === session.firstdivergence }));
14688
+ }
14689
+
14088
14690
  // taskqueue.ts
14089
14691
  function emptyqueue(input = {}) {
14090
14692
  return { lanes: input.lanes ?? [], priorities: input.priorities ?? [], completionpolicy: input.completionpolicy ?? "all", items: [], claims: [] };
@@ -15044,6 +15646,9 @@ function surfacesnapshot(input) {
15044
15646
  function interfaceviews(input) {
15045
15647
  return { version: protocolversion, ...input.datagrid !== void 0 ? { datagrid: input.datagrid } : {}, exportmenu: input.exportmenu, badge: input.badge, recenttray: input.recenttray, toasts: input.toasts, appearance: input.appearance };
15046
15648
  }
15649
+ function ecosystemviews(input) {
15650
+ return { version: protocolversion, library: input.library, installed: input.installed, syncbridge: input.syncbridge, attention: input.attention, backgroundruns: input.backgroundruns, ...input.replay !== void 0 ? { replay: input.replay } : {}, ...input.compare !== void 0 ? { compare: input.compare } : {} };
15651
+ }
15047
15652
 
15048
15653
  // workfloweditor.ts
15049
15654
  var palettecategories = ["actions", "controlflow", "waits", "variables", "triggers"];
@@ -15807,6 +16412,11 @@ export {
15807
16412
  attachcdpsession,
15808
16413
  attachtargetof,
15809
16414
  attachtimeline,
16415
+ attentioncountof,
16416
+ attentiondeeplinkof,
16417
+ attentionentryof,
16418
+ attentionnotifications,
16419
+ attentionseverityof,
15810
16420
  auditexcerptof,
15811
16421
  authconsentgranted,
15812
16422
  authorizeurl,
@@ -15814,11 +16424,17 @@ export {
15814
16424
  authreport,
15815
16425
  autointervalof,
15816
16426
  automationallowlistgate,
16427
+ backgroundqueueentryof,
16428
+ backgroundrunattention,
16429
+ backgroundrungate,
16430
+ backgroundrunsview,
16431
+ backgroundtrayrows,
15817
16432
  backoffdelay,
15818
16433
  badgecolorof,
15819
16434
  badgetextof,
15820
16435
  batchreport,
15821
16436
  beatrun,
16437
+ beginbackgroundrun,
15822
16438
  bindlocalhost,
15823
16439
  bindparam,
15824
16440
  bindvariables,
@@ -15864,6 +16480,7 @@ export {
15864
16480
  callmodel,
15865
16481
  callrest,
15866
16482
  callsreport,
16483
+ cancelbackgroundentry,
15867
16484
  cancelframes,
15868
16485
  cancellederror,
15869
16486
  cancelrun,
@@ -15909,12 +16526,15 @@ export {
15909
16526
  closeidlechannels,
15910
16527
  closeoffscreen,
15911
16528
  closerun,
16529
+ collectattention,
15912
16530
  collectmessages,
15913
16531
  collectresults,
15914
16532
  commandguard,
16533
+ comparemetricdefaults,
15915
16534
  compareoutputs,
15916
16535
  comparepairof,
15917
16536
  comparepairsforsteps,
16537
+ comparesessionmetrics,
15918
16538
  complete,
15919
16539
  composeworkflow,
15920
16540
  conditionof,
@@ -15922,6 +16542,7 @@ export {
15922
16542
  confirmdeletegate,
15923
16543
  confirmmanualrun,
15924
16544
  confirmpaygate,
16545
+ conflictsfor,
15925
16546
  connectallowentryof,
15926
16547
  connectallowgate,
15927
16548
  connectallowlist,
@@ -15963,12 +16584,14 @@ export {
15963
16584
  crossesviewport,
15964
16585
  cursorfrom,
15965
16586
  darklighttokensof,
16587
+ dataexpectationssummary,
15966
16588
  datagridcolumnsof,
15967
16589
  datagridof,
15968
16590
  datasetresponse,
15969
16591
  debuggate,
15970
16592
  debuggerconsentcovers,
15971
16593
  debugwaitbudgetallowed,
16594
+ dedupeattention,
15972
16595
  dedupeimages,
15973
16596
  defaultapprovalwindowms,
15974
16597
  defaultchallengelifetimems,
@@ -16003,6 +16626,7 @@ export {
16003
16626
  diffversions,
16004
16627
  disarmkillswitch,
16005
16628
  disconnectclient,
16629
+ dismissattention,
16006
16630
  dispatchtool,
16007
16631
  distillrunsummary,
16008
16632
  domainkinds,
@@ -16013,6 +16637,7 @@ export {
16013
16637
  dryrunprojection,
16014
16638
  dryrunreport,
16015
16639
  dryrunworkflow,
16640
+ ecosystemviews,
16016
16641
  editedcorrectionof,
16017
16642
  editnote,
16018
16643
  editorsavegate,
@@ -16032,6 +16657,7 @@ export {
16032
16657
  emulationstateof,
16033
16658
  enforcemaxclients,
16034
16659
  enqueue,
16660
+ enqueuebackgroundrun,
16035
16661
  enqueuerequest,
16036
16662
  entryfresh,
16037
16663
  entryhashof,
@@ -16069,6 +16695,7 @@ export {
16069
16695
  expirnotes,
16070
16696
  exportcontentreview,
16071
16697
  exportdatagrid,
16698
+ exportlibrarymanifests,
16072
16699
  exportlogchain,
16073
16700
  exportmenudescriptors,
16074
16701
  exportpresetlibrary,
@@ -16091,16 +16718,20 @@ export {
16091
16718
  fetchrequestof,
16092
16719
  fieldshapekind,
16093
16720
  fieldshaperegions,
16721
+ fileproviderof,
16094
16722
  filterdatagridrows,
16095
16723
  filteredsessions,
16096
16724
  filterentries,
16097
16725
  filterexchanges,
16098
16726
  filterlogstream,
16727
+ finishbackgroundrun,
16099
16728
  finishrecording,
16729
+ firstdivergenceof,
16100
16730
  fixedheadermatch,
16101
16731
  flowmetricnames,
16102
16732
  flowspecof,
16103
16733
  foreachof,
16734
+ forklibrary,
16104
16735
  formpayloadof,
16105
16736
  formreportresponse,
16106
16737
  framedlog,
@@ -16112,6 +16743,7 @@ export {
16112
16743
  gatestateof,
16113
16744
  generatedvalueallowed,
16114
16745
  grantallowlistentry,
16746
+ grantdiffof,
16115
16747
  graphqlopenvelope,
16116
16748
  graphqlrequestof,
16117
16749
  groupselect,
@@ -16159,6 +16791,7 @@ export {
16159
16791
  inheritconsent,
16160
16792
  initialize,
16161
16793
  inmemoryvault,
16794
+ installlibrary,
16162
16795
  interfaceviews,
16163
16796
  interleavetimeline,
16164
16797
  iscdpkind,
@@ -16181,6 +16814,7 @@ export {
16181
16814
  iswatchkind,
16182
16815
  isworkflowkind,
16183
16816
  joinbranches,
16817
+ joinruns,
16184
16818
  jsonpathrulesof,
16185
16819
  keepalivegate,
16186
16820
  keepaliveintervalvalid,
@@ -16195,6 +16829,18 @@ export {
16195
16829
  layernames,
16196
16830
  layoutreport,
16197
16831
  levelrank,
16832
+ librarybrowserow,
16833
+ librarycapabilitygate,
16834
+ libraryentryof,
16835
+ libraryeventof,
16836
+ librarygrantgate,
16837
+ libraryimportgate,
16838
+ librarymanifestgate,
16839
+ libraryproposalof,
16840
+ libraryquarantinegate,
16841
+ librarysearch,
16842
+ librarysensitivegate,
16843
+ librarystepsview,
16198
16844
  listapprovals,
16199
16845
  listdue,
16200
16846
  listremotestatus,
@@ -16225,6 +16871,7 @@ export {
16225
16871
  lookalikedistance,
16226
16872
  loopof,
16227
16873
  mailboxof,
16874
+ manifestdigest,
16228
16875
  manualpreview,
16229
16876
  manualrunpreview,
16230
16877
  mapresponse,
@@ -16286,6 +16933,7 @@ export {
16286
16933
  newsessiondiff,
16287
16934
  newsessionrecord,
16288
16935
  newworkflowrun,
16936
+ nextbackgroundrun,
16289
16937
  nextrequest,
16290
16938
  nobatchresolution,
16291
16939
  nonceof,
@@ -16326,6 +16974,10 @@ export {
16326
16974
  originprofilegate,
16327
16975
  originprofileof,
16328
16976
  outcomeresponse,
16977
+ outputcomparegate,
16978
+ outputcomparereadonlygate,
16979
+ outputcomparesessionof,
16980
+ outputcompareview,
16329
16981
  overlayslider,
16330
16982
  overrideinputof,
16331
16983
  overridematches,
@@ -16418,6 +17070,7 @@ export {
16418
17070
  providervalid,
16419
17071
  proxygate,
16420
17072
  proxyrouteof,
17073
+ pruneattention,
16421
17074
  prunerunstates,
16422
17075
  prunescratchpad,
16423
17076
  publishmessage,
@@ -16431,6 +17084,7 @@ export {
16431
17084
  quickactionsfor,
16432
17085
  randomid,
16433
17086
  rankapis,
17087
+ rankattention,
16434
17088
  rankcandidates,
16435
17089
  rankrecall,
16436
17090
  ratelimitboundsvalid,
@@ -16480,6 +17134,7 @@ export {
16480
17134
  releaselock,
16481
17135
  releaserunlock,
16482
17136
  removeedge,
17137
+ removelibrary,
16483
17138
  removenode,
16484
17139
  removetemplate,
16485
17140
  rendermessage,
@@ -16493,8 +17148,15 @@ export {
16493
17148
  replannonfail,
16494
17149
  replanreviewgate,
16495
17150
  replayagentrun,
17151
+ replaycursorof,
17152
+ replayjump,
17153
+ replaymove,
17154
+ replayplay,
17155
+ replayrestoredview,
17156
+ replaystepof,
16496
17157
  replaytrace,
16497
17158
  replayurl,
17159
+ replayviewaction,
16498
17160
  reportstep,
16499
17161
  requestbody,
16500
17162
  requestreview,
@@ -16505,6 +17167,7 @@ export {
16505
17167
  resolutionverdict,
16506
17168
  resolveappearance,
16507
17169
  resolveapproval,
17170
+ resolveconflict,
16508
17171
  resolvedrisk,
16509
17172
  resolveescalation,
16510
17173
  resolvegate,
@@ -16520,6 +17183,7 @@ export {
16520
17183
  restoreplanof,
16521
17184
  restorereviewgranted,
16522
17185
  resumeall,
17186
+ resumebackgroundqueue,
16523
17187
  resumehandoff,
16524
17188
  resumeone,
16525
17189
  retireentries,
@@ -16561,6 +17225,8 @@ export {
16561
17225
  runloop,
16562
17226
  runparallel,
16563
17227
  runrepeatuntil,
17228
+ runreplaygate,
17229
+ runreplaysessionof,
16564
17230
  runreviewgranted,
16565
17231
  runstep,
16566
17232
  runsummarytask,
@@ -16613,6 +17279,7 @@ export {
16613
17279
  sendmessage,
16614
17280
  sensitiveclassesof,
16615
17281
  sensitiveclassgate,
17282
+ sensitiveconsentfor,
16616
17283
  sensitivepipelingate,
16617
17284
  sequenceintegrity,
16618
17285
  serializearg,
@@ -16651,6 +17318,7 @@ export {
16651
17318
  shotpanelpan,
16652
17319
  shotpanelzoom,
16653
17320
  signalsreport,
17321
+ signmanifest,
16654
17322
  sitenoteof,
16655
17323
  sitenotesreadgate,
16656
17324
  sitenoteswritegate,
@@ -16680,6 +17348,7 @@ export {
16680
17348
  statusclassof,
16681
17349
  steal,
16682
17350
  stepapprovegate,
17351
+ stepcomparisonof,
16683
17352
  stepenvironmentvalid,
16684
17353
  stepmodeof,
16685
17354
  stepresolutionof,
@@ -16713,6 +17382,15 @@ export {
16713
17382
  swarmstateof,
16714
17383
  swarmstatereport,
16715
17384
  sweepreviews,
17385
+ syncbridgeexportpayload,
17386
+ syncbridgehookof,
17387
+ syncbridgeoptinflip,
17388
+ syncbridgeoptingate,
17389
+ syncbridgeproviders,
17390
+ syncbridgescan,
17391
+ syncbridgescopegate,
17392
+ syncbridgevalidate,
17393
+ syncdigestof,
16716
17394
  tabreportresponse,
16717
17395
  tabsessionkey,
16718
17396
  tabsessionrefof,
@@ -16721,6 +17399,7 @@ export {
16721
17399
  taskhistoryafter,
16722
17400
  taskinputof,
16723
17401
  taskinputproposalgate,
17402
+ taskinputsignatureof,
16724
17403
  taskstatechecksum,
16725
17404
  taskstateof,
16726
17405
  taskstatevalid,
@@ -16783,6 +17462,7 @@ export {
16783
17462
  unreadcount,
16784
17463
  untrustedrendergate,
16785
17464
  unwrapgraphql,
17465
+ updatelibrary,
16786
17466
  updaterule,
16787
17467
  urlencodeform,
16788
17468
  usagetotals,
@@ -16791,6 +17471,7 @@ export {
16791
17471
  validatefieldmatch,
16792
17472
  validateformrecord,
16793
17473
  validateframe,
17474
+ validatemanifest,
16794
17475
  validateregexrule,
16795
17476
  validatesiteoverride,
16796
17477
  validatestep,
@@ -16812,6 +17493,7 @@ export {
16812
17493
  verifyauth,
16813
17494
  verifylogchain,
16814
17495
  verifylogstream,
17496
+ verifypublishersignature,
16815
17497
  verifytoken,
16816
17498
  verifywebhook,
16817
17499
  visitmatch,
@@ -16823,6 +17505,7 @@ export {
16823
17505
  watchexpressionof,
16824
17506
  watchgate,
16825
17507
  webhooksecretok,
17508
+ webproviderstub,
16826
17509
  whileof,
16827
17510
  wildcardentry,
16828
17511
  windowgatesstep,