@ai-ecoverse/slicc-spectrum 1.90.0 → 1.92.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -406,7 +406,7 @@ An account whose status is `signing-in` (or a non-API-key account while its `con
406
406
  Accounts with `group: 'mcp'` (MCP servers) get their own **MCP servers** heading (`.accounts[data-group=mcp]`).
407
407
  An `api-key` account asks for its `secret`: “{provider} API key” by default, “{provider} token” for `secret: 'token'`; when it is `expired` it reads **API key rejected** or **Token rejected**.
408
408
  An MCP server with `auth: 'oauth'` signs in in a pop-up: its button reads **Sign in**, and it reads **Needs sign-in** when `disconnected` and **Sign-in expired** when `expired`.
409
- An account with `fields` (`{ name, label, required? }`) shows a plain labelled input for each, and their values go to `connect(id, secret?, fields)`.
409
+ An account with `fields` (`{ name, label, required?, options?, value? }`) shows a plain labelled input for each, and their values go to `connect(id, secret?, fields)`. A field with `options` (`{ value, label }`) is a dropdown (`select[data-account-field]`, with the inputs' `aria-required`, `aria-invalid` and `aria-describedby`) instead, so a provider can offer only the values it accepts, such as Bedrock's regions; it starts on the field's current `value`, otherwise on the first option, and an empty `options` list is a disabled dropdown, never a free-text input, and doesn't hold up Save even when `required`. The dummy's Amazon Bedrock account has one for its region.
410
410
  An account with `store: 'vault'` keeps its key in the vault when the `vault` port has `put`: the masked key field (C5's value rules) goes to `vault.put(name, key, undefined, { kind: 'model', provider: account.id })` (or `{ kind: 'mcp', server }` for `mcp:<server>` accounts, named `MCP_<SERVER>_TOKEN`; model records use pi-ai's environment-variable name), then `connect(id)` runs without the secret; a connected one says “Key kept in the vault”, “Token kept in the vault” or “Kept in the vault”, and Disconnect removes the record first.
411
411
  Without `store: 'vault'` or `vault.put`, the key goes to `connect(id, secret)` as before.
412
412
  A `show-surface` whose `section` is an account id scrolls to that row and focuses its button, and `accounts` scrolls to the Accounts heading (`h2[data-section=accounts]`).
@@ -429,7 +429,7 @@ The secrets, sorted by name (`li[data-secret][data-state]`, with `[data-rules]`,
429
429
  Locked, every form (Add secret, Replace value, Import, Export) says "Unlock the vault first" (`p[data-locked]`) next to the vault's own small **Unlock** button (`slicc-vault-button[data-action=unlock]`) and disables its submit; once unlocked, the form stays open with what was typed and its submit enables.
430
430
  Vault errors show their message, EACCES as "Unlock the vault first" and ENOTSUP as "This arrives with a later vault version".
431
431
  Each action shows only when the port has its method.
432
- Then **Rules SLICC refused** (`[data-refused]`), where the rules live (`[data-policy]`) and **Activity** (`ol.audit li[data-seq][data-type]`; an entry with `uid` and `tag` both `null` reads "by you", a `refresh` entry "Refreshed automatically" (with the sign-in it used), an `mcp` entry "Sent to the MCP server SERVER at DOMAIN" with its request and exit, and a policy entry lists its changes, its warning and, when accepted, how to change the file back; **Only reveals to programs**, `data-action="reveals"`, and **Show older**, `data-action="older"`).
432
+ Then **Rules SLICC refused** (`[data-refused]`), where the rules live (`[data-policy]`) and **Activity** (`ol.audit li[data-seq][data-type]`; an entry with `uid` and `tag` both `null` reads "by you", a `refresh` entry "Refreshed automatically" (with the sign-in it used), an `endpoints` entry (the vault removing model URLs an older agent registered) "Removed custom model URLs an agent set, automatically:" with each provider and URL and no "by …", an `mcp` entry "Sent to the MCP server SERVER at DOMAIN" with its request and exit, and a policy entry lists its changes, its warning and, when accepted, how to change the file back; **Only reveals to programs**, `data-action="reveals"`, and **Show older**, `data-action="older"`).
433
433
  The section's `data-vault` is `locked`, `unlocked` or `loading`.
434
434
  A popup the browser blocked shows how to allow it (`[data-popup=blocked]`).
435
435
  Widened-rule notices aren't shown.
@@ -982,7 +982,8 @@ Like slicc-agent's snapshot, the dummy's vitals are the budget, Spend, Active ag
982
982
  (`guest-follower`: the same without `decide`), or (`guest-always`) one guest tool call from Seat 2 (Mara) to `read_file` with `always: true`.
983
983
  Decisions are recorded in `model.approvals.decisions`, and `model.approvals.end(id, reason)` ends a request.
984
984
 
985
- `createDummyModel({ vault: 'empty' | 'secrets' | 'policy' | 'locked' | 'request' | 'backup' | 'waiting' | 'off' })` (`?vault=` on `/ui/`, off by default; `notice` is kept as another name for `policy`) adds an invented vault: no secrets yet; five secrets (an API key, a jerk lease from pier-nuc revealed to `pier publish`, a Tide Mail sign-in, one without a rule and a removed one) with an activity log that pages back once; the same with a refused rule and a policy change in the log; locked before the first unlock, with a waiting request from docs-pass; unlocked with a `fnox set` request for `TIDE_STATION_TOKEN`; the secrets with a due backup reminder; or a vault that hasn't answered yet (`model.vault.arrive()` brings it).
985
+ `createDummyModel({ vault: 'empty' | 'secrets' | 'policy' | 'locked' | 'request' | 'backup' | 'waiting' | 'purged' | 'off' })` (`?vault=` on `/ui/`, off by default; `notice` is kept as another name for `policy`) adds an invented vault: no secrets yet; five secrets (an API key, a jerk lease from pier-nuc revealed to `pier publish`, a Tide Mail sign-in, one without a rule and a removed one) with an activity log that pages back once; the same with a refused rule and a policy change in the log; locked before the first unlock, with a waiting request from docs-pass; unlocked with a `fnox set` request for `TIDE_STATION_TOKEN`; the secrets with a due backup reminder; or a vault that hasn't answered yet (`model.vault.arrive()` brings it).
986
+ `purged` is `secrets` plus an `endpoints` audit entry for two invented model URLs.
986
987
  It implements every op with the vault's checks, and keeps only names: `model.vault.puts` records `{ name, request? }`, `cancelled` the cancelled requests, `imports` each import's kind, size and pick, and `exported` the exports.
987
988
  Import offers five invented candidates (one replaces a secret, one is a model key, one is refused with a reason that the done stage repeats; KeePass adds a `_2` duplicate), six answers ENOTSUP, page ops are recorded with `uid: null, tag: null`, and value ops while locked answer EACCES.
988
989
  `model.vault.fail(code, message)` makes the next op fail.
@@ -67,9 +67,13 @@ var DummySettings = class extends Emitter {
67
67
  );
68
68
  this.emit("accounts", this.accounts());
69
69
  }
70
- async connect(id, secret) {
70
+ async connect(id, secret, fields) {
71
71
  const activation = globalThis.navigator?.userActivation;
72
- this.connects.push({ id, gesture: activation ? activation.isActive : null });
72
+ this.connects.push({
73
+ id,
74
+ gesture: activation ? activation.isActive : null,
75
+ ...fields ? { fields } : {}
76
+ });
73
77
  const account = this.#accounts.find((candidate) => candidate.id === id);
74
78
  if (account && account.auth !== "api-key" && !await this.#signIn(account)) return;
75
79
  if (account && account.auth !== "api-key" && this.#fails) {
@@ -115,4 +119,4 @@ export {
115
119
  dummySettingsKey,
116
120
  DummySettings
117
121
  };
118
- //# sourceMappingURL=chunk-VRFAMBWK.js.map
122
+ //# sourceMappingURL=chunk-3CM23WFV.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/dummy/clock.ts", "../src/dummy/settings.ts"],
4
+ "sourcesContent": ["export interface Clock {\n delay: number;\n sleep(ticks?: number): Promise<void>;\n}\n\nexport function clock(delay: number): Clock {\n return {\n delay,\n sleep: (ticks = 1) => new Promise((resolve) => setTimeout(resolve, delay * ticks)),\n };\n}\n", "import { Emitter } from '../model/emitter.ts';\nimport type {\n Account,\n AccountStatus,\n ModelOption,\n Settings,\n SettingsEvents,\n SettingsPort,\n} from '../model/types.ts';\nimport type { Clock } from './clock.ts';\n\nexport const dummySettingsKey = 'slicc-ui.settings';\nexport const signInClosed = 'The sign-in window was closed before it finished.';\n\nexport class DummySettings extends Emitter<SettingsEvents> implements SettingsPort {\n #settings: Settings;\n #accounts: Account[];\n #models: readonly ModelOption[];\n #storage: Storage | null;\n #clock: Clock;\n #keys: readonly string[];\n #signIns = new Map<string, { before: AccountStatus; stop: () => void }>();\n #gated: boolean;\n #fails: boolean;\n readonly connects: Array<{\n id: string;\n gesture: boolean | null;\n fields?: Record<string, string>;\n }> = [];\n\n constructor(\n defaults: Settings,\n models: readonly ModelOption[],\n accounts: readonly Account[],\n storage: Storage | null,\n clock: Clock,\n keys: readonly string[] = [dummySettingsKey],\n gated = false,\n login?: 'ok' | 'fail'\n ) {\n super();\n this.#fails = login === 'fail';\n this.#gated = gated;\n this.#keys = keys;\n this.#storage = storage;\n this.#clock = clock;\n this.#models = models;\n this.#accounts = accounts.map((account) => ({ ...account }));\n this.#settings = { ...defaults, ...this.#load() };\n }\n\n #load(): Partial<Settings> {\n try {\n const saved = this.#keys\n .map((key) => this.#storage?.getItem(key))\n .find((value) => value != null);\n return JSON.parse(saved ?? '{}');\n } catch {\n return {};\n }\n }\n\n get(): Settings {\n return { ...this.#settings };\n }\n\n update(patch: Partial<Settings>): void {\n this.#settings = { ...this.#settings, ...patch };\n this.#storage?.setItem(this.#keys[0], JSON.stringify(this.#settings));\n this.emit('settings', this.get());\n }\n\n models(): readonly ModelOption[] {\n if (!this.#gated) return this.#models;\n const live = new Set(\n this.#accounts\n .filter((account) => account.status === 'connected')\n .map((account) => account.provider)\n );\n return this.#models.filter((option) => live.has(option.provider));\n }\n\n accounts(): readonly Account[] {\n return this.#accounts.map((account) => ({ ...account }));\n }\n\n #set(id: string, patch: Partial<Account>): void {\n this.#accounts = this.#accounts.map((account) =>\n account.id === id ? { ...account, ...patch } : account\n );\n this.emit('accounts', this.accounts());\n }\n\n async connect(id: string, secret?: string, fields?: Record<string, string>): Promise<void> {\n const activation = (globalThis.navigator as Navigator | undefined)?.userActivation;\n this.connects.push({\n id,\n gesture: activation ? activation.isActive : null,\n ...(fields ? { fields } : {}),\n });\n const account = this.#accounts.find((candidate) => candidate.id === id);\n if (account && account.auth !== 'api-key' && !(await this.#signIn(account))) return;\n if (account && account.auth !== 'api-key' && this.#fails) {\n this.#set(id, { status: account.status });\n throw new Error(signInClosed);\n }\n if (account?.auth === 'api-key' || !account) await this.#clock.sleep(10);\n if (account?.auth === 'api-key' && account.store !== 'vault' && !secret)\n throw new Error(\n `${account.provider} needs ${account.secret === 'token' ? 'a token' : 'an API key'}`\n );\n const identity =\n account?.group === 'mcp'\n ? account.identity\n : account?.auth === 'api-key'\n ? 'API key'\n : account?.identity || `${id}-user@example.com`;\n this.#set(id, { status: 'connected', identity });\n }\n\n #signIn(account: Account): Promise<boolean> {\n const before = this.#signIns.get(account.id)?.before ?? account.status;\n this.#signIns.get(account.id)?.stop();\n this.#set(account.id, { status: 'signing-in' });\n return new Promise((resolve) => {\n const stop = () => {\n this.#signIns.delete(account.id);\n this.#set(account.id, { status: before });\n resolve(false);\n };\n this.#signIns.set(account.id, { before, stop });\n void this.#clock.sleep(100).then(() => {\n if (this.#signIns.get(account.id)?.stop !== stop) return;\n this.#signIns.delete(account.id);\n resolve(true);\n });\n });\n }\n\n cancel(id: string): void {\n this.#signIns.get(id)?.stop();\n }\n\n disconnect(id: string): void {\n this.#set(id, { status: 'disconnected' });\n }\n}\n"],
5
+ "mappings": ";;;;;AAKO,SAAS,MAAM,OAAsB;AAC1C,SAAO;AAAA,IACL;AAAA,IACA,OAAO,CAAC,QAAQ,MAAM,IAAI,QAAQ,CAAC,YAAY,WAAW,SAAS,QAAQ,KAAK,CAAC;AAAA,EACnF;AACF;;;ACCO,IAAM,mBAAmB;AACzB,IAAM,eAAe;AAErB,IAAM,gBAAN,cAA4B,QAAgD;AAAA,EACjF;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,WAAW,oBAAI,IAAyD;AAAA,EACxE;AAAA,EACA;AAAA,EACS,WAIJ,CAAC;AAAA,EAEN,YACE,UACA,QACA,UACA,SACAA,QACA,OAA0B,CAAC,gBAAgB,GAC3C,QAAQ,OACR,OACA;AACA,UAAM;AACN,SAAK,SAAS,UAAU;AACxB,SAAK,SAAS;AACd,SAAK,QAAQ;AACb,SAAK,WAAW;AAChB,SAAK,SAASA;AACd,SAAK,UAAU;AACf,SAAK,YAAY,SAAS,IAAI,CAAC,aAAa,EAAE,GAAG,QAAQ,EAAE;AAC3D,SAAK,YAAY,EAAE,GAAG,UAAU,GAAG,KAAK,MAAM,EAAE;AAAA,EAClD;AAAA,EAEA,QAA2B;AACzB,QAAI;AACF,YAAM,QAAQ,KAAK,MAChB,IAAI,CAAC,QAAQ,KAAK,UAAU,QAAQ,GAAG,CAAC,EACxC,KAAK,CAAC,UAAU,SAAS,IAAI;AAChC,aAAO,KAAK,MAAM,SAAS,IAAI;AAAA,IACjC,QAAQ;AACN,aAAO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EACH;AAAA,EAEA,OAAO,IAAkB;AACvB,SAAK,SAAS,IAAI,EAAE,GAAG,KAAK;AAAA,EAC9B;AAAA,EAEA,WAAW,IAAkB;AAC3B,SAAK,KAAK,IAAI,EAAE,QAAQ,eAAe,CAAC;AAAA,EAC1C;AACF;",
6
+ "names": ["clock"]
7
+ }
@@ -6,7 +6,7 @@ import {
6
6
  import {
7
7
  DummySettings,
8
8
  clock
9
- } from "./chunk-VRFAMBWK.js";
9
+ } from "./chunk-3CM23WFV.js";
10
10
  import {
11
11
  Emitter
12
12
  } from "./chunk-T5NHW4KC.js";
@@ -1587,6 +1587,27 @@ var accounts = [
1587
1587
  auth: "oauth"
1588
1588
  },
1589
1589
  { id: "openai", provider: "OpenAI", identity: "", status: "disconnected", auth: "api-key" },
1590
+ {
1591
+ id: "amazon-bedrock",
1592
+ provider: "Amazon Bedrock",
1593
+ identity: "",
1594
+ status: "disconnected",
1595
+ auth: "api-key",
1596
+ fields: [
1597
+ {
1598
+ name: "region",
1599
+ label: "Region",
1600
+ required: true,
1601
+ options: [
1602
+ { value: "us-east-1", label: "US East (N. Virginia)" },
1603
+ { value: "us-west-2", label: "US West (Oregon)" },
1604
+ { value: "eu-central-1", label: "Europe (Frankfurt)" },
1605
+ { value: "ap-northeast-1", label: "Asia Pacific (Tokyo)" }
1606
+ ],
1607
+ value: "us-west-2"
1608
+ }
1609
+ ]
1610
+ },
1590
1611
  {
1591
1612
  id: "mcp:docs",
1592
1613
  provider: "docs",
@@ -7020,6 +7041,20 @@ function vaultRefused() {
7020
7041
  }
7021
7042
  ];
7022
7043
  }
7044
+ function vaultPurged(now2 = Date.now()) {
7045
+ return {
7046
+ type: "endpoints",
7047
+ seq: 13,
7048
+ id: "audit-13",
7049
+ at: now2 - 30 * minute3,
7050
+ uid: null,
7051
+ tag: null,
7052
+ purged: [
7053
+ { provider: "openai", url: "https://models.harbor.example/v1" },
7054
+ { provider: "anthropic", url: "https://relay.harbor.example" }
7055
+ ]
7056
+ };
7057
+ }
7023
7058
  function vaultPolicy(now2 = Date.now()) {
7024
7059
  return {
7025
7060
  type: "policy",
@@ -7109,7 +7144,11 @@ function vaultFixtures(scenario, now2 = Date.now()) {
7109
7144
  const list = {
7110
7145
  secrets,
7111
7146
  refused: policy ? vaultRefused() : [],
7112
- audit: empty ? [] : [...policy ? [vaultPolicy(now2)] : [], ...vaultAudit(now2)],
7147
+ audit: empty ? [] : [
7148
+ ...policy ? [vaultPolicy(now2)] : [],
7149
+ ...scenario === "purged" ? [vaultPurged(now2)] : [],
7150
+ ...vaultAudit(now2)
7151
+ ],
7113
7152
  auditMore: !empty,
7114
7153
  exits: {
7115
7154
  file: "/etc/slicc/secrets-policy.toml",
@@ -7615,6 +7654,7 @@ export {
7615
7654
  vaultNotice,
7616
7655
  vaultOlder,
7617
7656
  vaultPolicy,
7657
+ vaultPurged,
7618
7658
  vaultRefused,
7619
7659
  vaultSecrets
7620
7660
  };