paracosm 0.9.885 → 0.9.951

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/LICENSE CHANGED
@@ -175,7 +175,7 @@
175
175
 
176
176
  END OF TERMS AND CONDITIONS
177
177
 
178
- Copyright 2026 Manic Agency LLC / Frame.dev
178
+ Copyright 2026 Framers Lab, Inc.
179
179
 
180
180
  Licensed under the Apache License, Version 2.0 (the "License");
181
181
  you may not use this file except in compliance with the License.
package/README.md CHANGED
@@ -10,7 +10,7 @@
10
10
 
11
11
  <p align="center">
12
12
  <a href="https://www.npmjs.com/package/paracosm"><img src="https://img.shields.io/npm/v/paracosm?style=flat-square&color=e8b44a&labelColor=14110e" alt="npm" /></a>
13
- <a href="https://github.com/framersai/paracosm/blob/master/LICENSE"><img src="https://img.shields.io/badge/license-Apache--2.0-e06530?style=flat-square&labelColor=14110e" alt="License" /></a>
13
+ <a href="https://github.com/framerslab/paracosm/blob/master/LICENSE"><img src="https://img.shields.io/badge/license-Apache--2.0-e06530?style=flat-square&labelColor=14110e" alt="License" /></a>
14
14
  <a href="https://paracosm.agentos.sh/docs"><img src="https://img.shields.io/badge/docs-API%20Reference-4ca8a8?style=flat-square&labelColor=14110e" alt="Docs" /></a>
15
15
  <a href="https://agentos.sh/en"><img src="https://img.shields.io/badge/built%20on-AgentOS-e06530?style=flat-square&labelColor=14110e" alt="AgentOS" /></a>
16
16
  </p>
@@ -32,7 +32,7 @@
32
32
  </p>
33
33
 
34
34
  <p align="center">
35
- <a href="https://paracosm.agentos.sh/demo/e2e-atlas-8-hero.mp4">▶ Full 90-second demo</a>
35
+ <a href="https://paracosm.agentos.sh/demo/e2e-atlas-8-hero.mp4">▶ 34-second demo</a>
36
36
  &nbsp;·&nbsp;
37
37
  <a href="https://paracosm.agentos.sh/demo/digital-twin-maria-2-hero.mp4">▶ Digital twin</a>
38
38
  </p>
@@ -265,7 +265,7 @@ Each call to `wm.simulate` takes one actor. The dashboard fans cohorts out side-
265
265
  ### Or use the dashboard
266
266
 
267
267
  ```bash
268
- git clone https://github.com/framersai/paracosm
268
+ git clone https://github.com/framerslab/paracosm
269
269
  cd paracosm && npm install
270
270
  cp .env.example .env # add OPENAI_API_KEY or ANTHROPIC_API_KEY
271
271
  npm run dashboard # opens http://localhost:3456
@@ -287,6 +287,42 @@ paracosm init my-app --domain "Submarine crew of 8" --actors 3
287
287
 
288
288
  The CLI looks for `actors.json` via `--actors`, then `./actors.json`, then `./config/actors.json`, then a bundled example. A back-compat `paracosm-dashboard` alias is shipped for existing scripts and Docker invocations.
289
289
 
290
+ ### Share a sim with a one-click link
291
+
292
+ The dashboard ships two ways to produce a shareable run link, both landing the viewer on the visualization tab with no upload step.
293
+
294
+ **From the dashboard UI** — three places now copy `paracosm.agentos.sh/sim?replay=<sessionId>&tab=viz` to the clipboard:
295
+
296
+ - **TopBar overflow menu** (⋯ → Share viz link) — for the run you're currently watching, including replays loaded from a previously shared link.
297
+ - **Quickstart actor cards** — per-actor "Copy viz share link" button.
298
+ - **Library row Share button** — for any historical run whose broadcast session was successfully linked at save time (any run completed after this feature shipped). Library rows from before the link wire-up render without the Share button.
299
+
300
+ All three routes hit the public `/sessions/:id/replay` SSE endpoint so the viewer streams the stored run directly.
301
+
302
+ **By URL construction** — any remote `.json` save can be turned into a deep link that auto-fetches, parses, and lands on the tab you choose. No upload step, no preview modal.
303
+
304
+ ```
305
+ https://paracosm.agentos.sh/sim?load=<remote-json-url>&tab=viz&autoload=1
306
+ ```
307
+
308
+ | Param | Required | Behaviour |
309
+ | ---------- | -------- | --------- |
310
+ | `load` | yes | URL of the remote `.json` save. Must be `http:` or `https:` and CORS-readable. Pastebins, gists, S3, GitHub raw all work. |
311
+ | `tab` | no | Tab to open after the run loads. `sim` (default), `viz`, `reports`, `chat`, `library`, `settings`, `studio`. Invalid values fall back to `sim`. |
312
+ | `autoload` | no | `1` or `true` skips the F9 preview modal and confirms the load automatically. Omit to show the preview confirm step. |
313
+
314
+ Concrete share links:
315
+
316
+ ```
317
+ # r/dataisbeautiful drop — opens straight on the swarm viz
318
+ paracosm.agentos.sh/sim?load=https://gist.githubusercontent.com/<user>/<id>/raw/mars-run.json&tab=viz&autoload=1
319
+
320
+ # Linked from a bug report — opens the reports tab with preview shown
321
+ paracosm.agentos.sh/sim?load=https://example.com/runs/diverged-run.json&tab=reports
322
+ ```
323
+
324
+ The `?load=` and `?autoload=` params are stripped after the fetch resolves, so refreshing the page won't re-download. `?tab=` is kept so the URL survives copy/paste. Cross-origin fetches require the host to send permissive CORS headers (`Access-Control-Allow-Origin: *` on Gists, S3 with the right bucket policy, etc.).
325
+
290
326
  ---
291
327
 
292
328
  ## The universal result contract
@@ -507,6 +543,6 @@ Apache-2.0
507
543
  ---
508
544
 
509
545
  <p align="center">
510
- Built by <a href="https://manic.agency">Manic Agency LLC</a> · <a href="https://frame.dev">Frame.dev</a><br />
546
+ Built by <a href="https://frame.dev">Frame.dev</a><br />
511
547
  <a href="mailto:team@frame.dev">team@frame.dev</a>
512
548
  </p>
package/dist/cli/help.js CHANGED
@@ -34,7 +34,7 @@ Examples:
34
34
  paracosm init my-app --domain "Submarine crew of 8" # scaffold a project
35
35
 
36
36
  Docs: https://paracosm.agentos.sh/docs
37
- GitHub: https://github.com/framersai/paracosm
37
+ GitHub: https://github.com/framerslab/paracosm
38
38
  `;
39
39
  const RUN_HELP = `paracosm run [options]
40
40
 
@@ -99,7 +99,7 @@ node run.mjs
99
99
  - Edit \`actors.json\` to swap HEXACO traits or instructions.
100
100
  - Edit \`run.mjs\` to change the actor index, mode, turn count, or seed.
101
101
 
102
- See https://github.com/framersai/paracosm for the full API reference.
102
+ See https://github.com/framerslab/paracosm for the full API reference.
103
103
  `;
104
104
  }
105
105
  export function renderEnvExample() {
@@ -393,7 +393,7 @@ export interface ScenarioPackage {
393
393
  id: string;
394
394
  /**
395
395
  * Optional permalink to the scenario JSON in the public repo (e.g.
396
- * https://github.com/framersai/paracosm/blob/master/scenarios/mars.json).
396
+ * https://github.com/framerslab/paracosm/blob/master/scenarios/mars.json).
397
397
  * Surfaced in the dashboard so users can read or fork the scenario
398
398
  * source from the settings panel without leaving the app.
399
399
  */
@@ -18,7 +18,7 @@ export declare const CommanderDecisionSchema: z.ZodObject<{
18
18
  reasoning: z.ZodDefault<z.ZodString>;
19
19
  departmentsConsulted: z.ZodDefault<z.ZodArray<z.ZodString>>;
20
20
  selectedPolicies: z.ZodDefault<z.ZodArray<z.ZodString>>;
21
- rejectedPolicies: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodDefault<z.ZodArray<z.ZodObject<{
21
+ rejectedPolicies: z.ZodPreprocess<z.ZodDefault<z.ZodArray<z.ZodObject<{
22
22
  policy: z.ZodString;
23
23
  reason: z.ZodDefault<z.ZodString>;
24
24
  }, z.core.$strip>>>>;
@@ -1 +1 @@
1
- {"version":3,"file":"server-app.d.ts","sourceRoot":"","sources":["../../src/server/server-app.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsC,KAAK,MAAM,EAAuB,MAAM,WAAW,CAAC;AAIjG,OAAO,EAA4C,KAAK,0BAA0B,EAA+B,MAAM,sBAAsB,CAAC;AAC9I,OAAO,EAA8D,KAAK,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAWrH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AA6B1D,OAAO,EAAoB,KAAK,YAAY,EAAyB,MAAM,qBAAqB,CAAC;AAKjG,OAAO,EAA6B,KAAK,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAuG1F,MAAM,WAAW,uBAAuB;IACtC,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC;IACxB,kBAAkB,CAAC,EAAE,CACnB,MAAM,EAAE,0BAA0B,EAClC,SAAS,EAAE,WAAW,EACtB,MAAM,CAAC,EAAE,WAAW,EACpB,QAAQ,CAAC,EAAE,eAAe,EAC1B,UAAU,CAAC,EAAE,CACX,QAAQ,EAAE,OAAO,2BAA2B,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E,CAAC;wBAC3L,KAAK,CAAC;YAAE,IAAI,CAAC,EAAE,MAAM,CAAC;YAAC,IAAI,CAAC,EAAE,MAAM,CAAC;YAAC,SAAS,CAAC,EAAE,OAAO,EAAE,CAAC;YAAC,cAAc,CAAC,EAAE,MAAM,CAAA;SAAE,CAAC;oBAC3F,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;0BACxB,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;;;EAoEnD;AAED,wBAAgB,gBAAgB,CAAC,OAAO,GAAE,uBAA4B,GAAG,UAAU,CAu9FlF"}
@@ -606,6 +606,13 @@ export function createMarsServer(options = {}) {
606
606
  // for the surviving actor — replay UX then advertised a half-broken
607
607
  // session as cached state.
608
608
  let currentRunErrored = false;
609
+ // RunRecord ids inserted by onArtifactPersist for the current
610
+ // broadcast. After autoSaveOnComplete resolves a fresh sessionId,
611
+ // these are backfilled with `runHistoryStore.linkSessionId` so the
612
+ // Library row's "Copy viz share link" button can build a deep link
613
+ // to the same session-store replay endpoint. Reset in
614
+ // clearEventBuffer alongside the other per-run flags.
615
+ const currentRunInsertedRunIds = [];
609
616
  const AUTO_SAVE_MIN_TURNS = 1;
610
617
  // Persistent storage for completed sim runs. Lives at
611
618
  // `${APP_DIR}/data/sessions.db`; the directory is created on first
@@ -878,6 +885,20 @@ export function createMarsServer(options = {}) {
878
885
  const result = await sessionStore.saveSession(events);
879
886
  const storeCount = await sessionStore.count();
880
887
  console.log(`[sessions] auto-saved run ${result.id}: ${events.length} events, ${turnDoneCount} turns (store count: ${storeCount})`);
888
+ // Backfill session_id onto every RunRecord that onArtifactPersist
889
+ // inserted for this broadcast. Wrapped in try/catch because a
890
+ // link failure must not abort the save broadcast — the run is
891
+ // already in the session store and replayable by sessionId; the
892
+ // missing column just hides the Library row's Share button until
893
+ // the next time this same broadcast saves (idempotent UPDATE).
894
+ if (currentRunInsertedRunIds.length > 0 && runHistoryStore.linkSessionId) {
895
+ try {
896
+ await runHistoryStore.linkSessionId([...currentRunInsertedRunIds], result.id);
897
+ }
898
+ catch (error) {
899
+ console.warn('[run-history] linkSessionId failed:', error);
900
+ }
901
+ }
881
902
  emitSaveStatus('saved', {
882
903
  id: result.id,
883
904
  evictedId: result.evictedId,
@@ -988,6 +1009,7 @@ export function createMarsServer(options = {}) {
988
1009
  currentRunAborted = false;
989
1010
  currentRunSaved = false;
990
1011
  currentRunErrored = false;
1012
+ currentRunInsertedRunIds.length = 0;
991
1013
  eventBuffer.length = 0;
992
1014
  eventTimestamps.length = 0;
993
1015
  eventActorIds.length = 0;
@@ -2589,6 +2611,11 @@ export function createMarsServer(options = {}) {
2589
2611
  };
2590
2612
  const enriched = enrichRunRecordFromArtifact(perArtifactBase, artifact);
2591
2613
  await runHistoryStore.insertRun(enriched);
2614
+ // Remember the runId so autoSaveOnComplete can backfill
2615
+ // session_id once the broadcast's sessionStore.saveSession
2616
+ // returns. The push happens AFTER insertRun resolves so a
2617
+ // failed insert doesn't enqueue a runId that doesn't exist.
2618
+ currentRunInsertedRunIds.push(enriched.runId);
2592
2619
  }
2593
2620
  catch (error) {
2594
2621
  console.warn('[run-history] per-artifact insert failed:', error);
@@ -2982,7 +3009,7 @@ export function createMarsServer(options = {}) {
2982
3009
  <a href="/">Home</a>
2983
3010
  <a href="/sim">Simulation</a>
2984
3011
  <a href="/docs">API Docs</a>
2985
- <a href="https://github.com/framersai/paracosm" target="_blank" rel="noopener">GitHub</a>
3012
+ <a href="https://github.com/framerslab/paracosm" target="_blank" rel="noopener">GitHub</a>
2986
3013
  <a href="https://www.npmjs.com/package/paracosm" target="_blank" rel="noopener">npm</a>
2987
3014
  <button class="pdh-search" onclick="document.getElementById('tsd-search-trigger')?.click()" aria-label="Search docs"><svg width="14" height="14" viewBox="0 0 16 16" fill="none"><circle cx="7" cy="7" r="5.5" stroke="currentColor" stroke-width="1.5"/><line x1="11" y1="11" x2="15" y2="15" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"/></svg></button>
2988
3015
  <button class="pdh-theme" id="pdh-theme-toggle" aria-label="Toggle theme"></button>
@@ -2993,7 +3020,7 @@ export function createMarsServer(options = {}) {
2993
3020
  <a href="/">Home</a>
2994
3021
  <a href="/sim">Simulation</a>
2995
3022
  <a href="/docs">API Docs</a>
2996
- <a href="https://github.com/framersai/paracosm" target="_blank" rel="noopener">GitHub</a>
3023
+ <a href="https://github.com/framerslab/paracosm" target="_blank" rel="noopener">GitHub</a>
2997
3024
  <a href="https://www.npmjs.com/package/paracosm" target="_blank" rel="noopener">npm</a>
2998
3025
  <a href="https://agentos.sh/en" target="_blank" rel="noopener">AgentOS</a>
2999
3026
  <a href="https://wilds.ai/discord" target="_blank" rel="noopener">Discord</a>
@@ -3071,12 +3098,12 @@ export function createMarsServer(options = {}) {
3071
3098
  html = html.replace('</body>', `<div class="paracosm-docs-footer">
3072
3099
  <div class="pdf-links">
3073
3100
  <a href="https://agentos.sh/en">agentos.sh</a>
3074
- <a href="https://github.com/framersai/paracosm">GitHub</a>
3101
+ <a href="https://github.com/framerslab/paracosm">GitHub</a>
3075
3102
  <a href="https://www.npmjs.com/package/paracosm">npm</a>
3076
3103
  <a href="https://frame.dev">Frame.dev</a>
3077
- <a href="https://manic.agency">Manic Agency</a>
3104
+ <a href="https://frame.dev">Frame</a>
3078
3105
  </div>
3079
- <span><span style="font-family:'JetBrains Mono','SF Mono',Menlo,monospace;font-weight:700;letter-spacing:.08em;font-size:10px">PARA<span style="color:#e8b44a">COSM</span></span> &middot; Apache-2.0 &middot; <a href="https://manic.agency">Manic Agency</a> / <a href="https://frame.dev">Frame.dev</a></span>
3106
+ <span><span style="font-family:'JetBrains Mono','SF Mono',Menlo,monospace;font-weight:700;letter-spacing:.08em;font-size:10px">PARA<span style="color:#e8b44a">COSM</span></span> &middot; Apache-2.0 &middot; <a href="https://frame.dev">Frame.dev</a></span>
3080
3107
  </div></body>`);
3081
3108
  res.writeHead(200, { 'Content-Type': 'text/html', 'Cache-Control': 'no-cache' });
3082
3109
  res.end(html);