@bunshin-cc/bunshin 0.11.2 → 0.11.3

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 (2) hide show
  1. package/dist/bin.js +58 -59
  2. package/package.json +10 -11
package/dist/bin.js CHANGED
@@ -983,32 +983,31 @@ var init_text = __esm({
983
983
  "vs"
984
984
  ]);
985
985
  PHRASE_ENTITIES = [
986
- "negative balance",
987
986
  "account closure",
988
987
  "close account",
989
988
  "closed account",
989
+ "delete account",
990
+ "account deletion",
991
+ "workspace deletion",
992
+ "data deletion",
993
+ "data retention",
994
+ "data export",
995
+ "personal data",
996
+ "legal hold",
990
997
  "opt out",
991
998
  "opt-out",
992
- "apr",
993
- "interest rate",
994
- "chargeback",
999
+ "cancel subscription",
1000
+ "subscription cancellation",
995
1001
  "refund",
996
- "credit balance",
1002
+ "chargeback",
1003
+ "invoice",
1004
+ "dispute",
997
1005
  "write off",
998
1006
  "write-off",
999
- "collections",
1000
1007
  "settlement",
1001
- "dispute",
1002
- "kyc",
1003
- "aml",
1004
- "statement",
1005
- "billing cycle",
1006
- "late fee",
1007
- "credit limit",
1008
- "minimum payment",
1009
- "direct debit",
1010
- "card replacement",
1011
- "fraud hold"
1008
+ "offboarding",
1009
+ "access review",
1010
+ "audit log"
1012
1011
  ];
1013
1012
  CONSTRAINT_PATTERNS = [
1014
1013
  /\bmanual(?:ly)?\s+(?:process|step|review|closure|approval|handled|handle|close)\b/i,
@@ -2901,7 +2900,7 @@ ${sep}${rows.join("\n")}` : null;
2901
2900
  }
2902
2901
  },
2903
2902
  {
2904
- // Customer-adjacent identifiers named as such: customerId, loan account XUCS389, /loans/XUCS389, accountId=ABCD1234.
2903
+ // Customer-adjacent identifiers named as such: customerId, loan account ABC1234, /loans/ABC1234, accountId=ABCD1234.
2905
2904
  // Only values with a digit (a type name or a word in a spec is left alone).
2906
2905
  kind: "customer-id",
2907
2906
  marker: "[CUSTOMER-ID]",
@@ -4029,38 +4028,38 @@ var init_reconcile2 = __esm({
4029
4028
  }
4030
4029
  });
4031
4030
 
4032
- // ../core/src/examples/apr.ts
4033
- function aprScenario(now = (/* @__PURE__ */ new Date()).toISOString()) {
4031
+ // ../core/src/examples/demo.ts
4032
+ function demoScenario(now = (/* @__PURE__ */ new Date()).toISOString()) {
4034
4033
  const constraint = {
4035
4034
  id: "l_00000001",
4036
4035
  kind: "fact",
4037
- title: "Collections must clear negative balances before account closure",
4038
- gist: "Negative-balance accounts require manual handling by Collections before they can close.",
4039
- content: "When the company owes a customer money, Collections clears the negative balance through a manual process. Account closure automation must not close these accounts. Route them to Collections and wait for confirmation that the balance has been cleared.",
4040
- tags: ["account-closure", "negative-balance", "collections", "manual-process"],
4036
+ title: "Legal must release a legal hold before workspace deletion",
4037
+ gist: "Workspaces under a legal hold must be preserved until Legal releases the hold by hand.",
4038
+ content: "When a customer is part of a dispute or investigation, Legal places their workspace under a legal hold through a manual process. Workspace deletion automation must not delete these workspaces. Route them to Legal and wait for confirmation that the hold has been released.",
4039
+ tags: ["workspace-deletion", "legal-hold", "legal", "manual-process"],
4041
4040
  status: "active",
4042
4041
  clearance: "org",
4043
4042
  version: 1,
4044
4043
  updatedAt: now,
4045
- provenance: { orgId: APR_ENGINEER.orgId, userId: "ops", role: "collections-analyst", orgUnit: "operations/collections", harness: "other", createdAt: now },
4044
+ provenance: { orgId: DEMO_ENGINEER.orgId, userId: "counsel", role: "legal-counsel", orgUnit: "legal/commercial", harness: "other", createdAt: now },
4046
4045
  stats: { served: 0, used: 0, helped: 0, hurt: 0 }
4047
4046
  };
4048
4047
  const workflow = {
4049
4048
  ...constraint,
4050
4049
  id: "l_00000002",
4051
4050
  kind: "workflow",
4052
- title: "Implement account closure with a Collections handoff",
4053
- gist: "Check the balance, branch to manual handling when needed, and verify both closure paths.",
4054
- content: "Use this workflow when building APR opt-out account closure automation.",
4055
- provenance: { ...constraint.provenance, userId: "payments-lead", role: "backend-engineer", orgUnit: "engineering/payments" },
4056
- preconditions: ["Read the current account balance", "Confirm the Collections handoff with its owner"],
4051
+ title: "Implement workspace deletion with a legal hold check",
4052
+ gist: "Check for a hold, branch to Legal when needed, and verify both deletion paths.",
4053
+ content: "Use this workflow when building workspace deletion automation after a subscription is cancelled.",
4054
+ provenance: { ...constraint.provenance, userId: "platform-lead", role: "backend-engineer", orgUnit: "engineering/platform" },
4055
+ preconditions: ["Read the workspace's current legal hold status", "Confirm the Legal handoff with its owner"],
4057
4056
  steps: [
4058
- { n: 1, action: "Read the balance before attempting account closure", verify: "The decision uses the latest balance." },
4059
- { n: 2, action: "For a negative balance, queue manual handling and leave the account open", verify: "The Collections handoff exists and no closure request was sent." },
4060
- { n: 3, action: "Close eligible accounts only after all closure prerequisites pass", verify: "The account status changes to closed only on the eligible branch." },
4061
- { n: 4, action: "Test negative, zero, and positive balances, including a retried handoff", verify: "Negative balances stay open; repeated delivery does not duplicate the handoff." }
4057
+ { n: 1, action: "Read the legal hold status before attempting workspace deletion", verify: "The decision uses the latest hold status." },
4058
+ { n: 2, action: "For a workspace under legal hold, queue it for Legal and keep its data", verify: "The Legal handoff exists and no deletion request was sent." },
4059
+ { n: 3, action: "Delete eligible workspaces only after all deletion prerequisites pass", verify: "Data is deleted only on the eligible branch." },
4060
+ { n: 4, action: "Test held, released, and never-held workspaces, including a retried handoff", verify: "Held workspaces keep their data; repeated delivery does not duplicate the handoff." }
4062
4061
  ],
4063
- outcome: "Eligible accounts close and negative-balance accounts remain open for Collections."
4062
+ outcome: "Eligible workspaces are deleted and workspaces under legal hold are preserved for Legal."
4064
4063
  };
4065
4064
  return {
4066
4065
  constraint,
@@ -4068,25 +4067,25 @@ function aprScenario(now = (/* @__PURE__ */ new Date()).toISOString()) {
4068
4067
  lessons: [
4069
4068
  constraint,
4070
4069
  workflow,
4071
- { ...constraint, id: "l_00000003", title: "Board plan for APR pricing", gist: "Confidential APR strategy", content: "Executive-only pricing strategy.", clearance: "csuite", provenance: { ...constraint.provenance, userId: "ceo", role: "ceo", orgUnit: "executive" } },
4072
- { ...constraint, id: "l_00000004", title: "Facilities visitor badges", gist: "Visitor badges require manual approval.", content: "Facilities must approve visitor badges.", tags: ["facilities", "badges"], provenance: { ...constraint.provenance, userId: "facilities", orgUnit: "facilities/london" } },
4073
- { ...constraint, id: "l_00000005", title: "Old account closure procedure", status: "superseded" },
4070
+ { ...constraint, id: "l_00000003", title: "Board plan for next year's pricing", gist: "Confidential pricing strategy", content: "Executive-only pricing strategy.", clearance: "csuite", provenance: { ...constraint.provenance, userId: "ceo", role: "ceo", orgUnit: "executive" } },
4071
+ { ...constraint, id: "l_00000004", title: "Facilities visitor badges", gist: "Visitor badges require manual approval.", content: "Facilities must approve visitor badges.", tags: ["facilities", "badges"], provenance: { ...constraint.provenance, userId: "facilities", orgUnit: "facilities/hq" } },
4072
+ { ...constraint, id: "l_00000005", title: "Old workspace deletion procedure", status: "superseded" },
4074
4073
  { ...constraint, id: "l_00000006", provenance: { ...constraint.provenance, orgId: "another-company" } }
4075
4074
  ]
4076
4075
  };
4077
4076
  }
4078
- var APR_TASK, APR_ENGINEER;
4079
- var init_apr = __esm({
4080
- "../core/src/examples/apr.ts"() {
4077
+ var DEMO_TASK, DEMO_ENGINEER;
4078
+ var init_demo = __esm({
4079
+ "../core/src/examples/demo.ts"() {
4081
4080
  "use strict";
4082
- APR_TASK = "Implement APR opt-out: automatically close the customer's account and stop billing when they reject the new interest rate.";
4083
- APR_ENGINEER = {
4081
+ DEMO_TASK = "Automate workspace deletion: when a customer cancels their subscription, delete their workspace and its data after 30 days.";
4082
+ DEMO_ENGINEER = {
4084
4083
  orgId: "org_demo",
4085
4084
  userId: "engineer",
4086
4085
  role: "backend-engineer",
4087
- orgUnit: "engineering/payments",
4086
+ orgUnit: "engineering/platform",
4088
4087
  clearance: "team",
4089
- responsibilities: ["account closure", "APR opt-out", "billing"]
4088
+ responsibilities: ["workspace deletion", "subscription cancellation", "data retention"]
4090
4089
  };
4091
4090
  }
4092
4091
  });
@@ -4112,7 +4111,7 @@ var init_src = __esm({
4112
4111
  init_reflect2();
4113
4112
  init_metaReflect();
4114
4113
  init_reconcile2();
4115
- init_apr();
4114
+ init_demo();
4116
4115
  }
4117
4116
  });
4118
4117
 
@@ -10069,25 +10068,25 @@ import path22 from "node:path";
10069
10068
  async function runDemo(write) {
10070
10069
  const root = fs27.mkdtempSync(path22.join(os4.tmpdir(), "bunshin-demo-"));
10071
10070
  try {
10072
- const store = Store.init(root, { ...APR_ENGINEER, apiUrl: "" });
10073
- const { lessons, constraint, workflow } = aprScenario();
10071
+ const store = Store.init(root, { ...DEMO_ENGINEER, apiUrl: "" });
10072
+ const { lessons, constraint, workflow } = demoScenario();
10074
10073
  for (const lesson of lessons) store.saveLesson(lesson);
10075
- const result = await runRecall(store, { sessionId: "demo", prompt: APR_TASK, dryRun: true, offline: true });
10076
- assert(result.trace.served.includes(constraint.id), "Collections constraint was missed");
10077
- assert(result.trace.served.includes(workflow.id), "Closure workflow was missed");
10074
+ const result = await runRecall(store, { sessionId: "demo", prompt: DEMO_TASK, dryRun: true, offline: true });
10075
+ assert(result.trace.served.includes(constraint.id), "Legal hold constraint was missed");
10076
+ assert(result.trace.served.includes(workflow.id), "Deletion workflow was missed");
10078
10077
  assert(result.trace.candidates.every((c) => !["l_00000003", "l_00000005", "l_00000006"].includes(c.lessonId)), "Restricted or superseded knowledge entered the candidate list");
10079
- write(`Bunshin APR demo \u2014 synthetic data, offline scoring
10078
+ write(`Bunshin demo \u2014 synthetic data, offline scoring
10080
10079
 
10081
- Task: ${APR_TASK}
10080
+ Task: ${DEMO_TASK}
10082
10081
 
10083
10082
  `);
10084
10083
  write(result.text);
10085
- write("\nPASS: Collections constraint and workflow recalled; C-suite, other-company, and superseded lessons excluded.\n");
10084
+ write("\nPASS: Legal hold constraint and deletion workflow recalled; C-suite, other-company, and superseded lessons excluded.\n");
10086
10085
  } finally {
10087
10086
  fs27.rmSync(root, { recursive: true, force: true });
10088
10087
  }
10089
10088
  }
10090
- var init_demo = __esm({
10089
+ var init_demo2 = __esm({
10091
10090
  "src/demo.ts"() {
10092
10091
  "use strict";
10093
10092
  init_src();
@@ -12571,7 +12570,7 @@ Key saved privately outside the project.
12571
12570
  return 0;
12572
12571
  }
12573
12572
  if (cmd === "demo") {
12574
- const { runDemo: runDemo2 } = await Promise.resolve().then(() => (init_demo(), demo_exports));
12573
+ const { runDemo: runDemo2 } = await Promise.resolve().then(() => (init_demo2(), demo_exports));
12575
12574
  await runDemo2(out);
12576
12575
  return 0;
12577
12576
  }
@@ -12822,7 +12821,7 @@ function hookCount(file2) {
12822
12821
  async function cmdRecall2(store, args, cwd, out, err) {
12823
12822
  const task = args._.slice(1).join(" ").trim() || str7(args.flags.task) || "";
12824
12823
  if (!task) {
12825
- err('bunshin recall: a task is required, e.g. bunshin recall "close an account with a negative balance"\n');
12824
+ err('bunshin recall: a task is required, e.g. bunshin recall "delete a workspace after its subscription is cancelled"\n');
12826
12825
  return 1;
12827
12826
  }
12828
12827
  const { runRecall: runRecall2 } = await Promise.resolve().then(() => (init_recall3(), recall_exports));
@@ -12921,7 +12920,7 @@ ${lessons.length} lesson(s). \`bunshin lessons show <id>\` for the full body.
12921
12920
  function cmdLessonAdd(store, args, out, err) {
12922
12921
  const title = str7(args.flags.title);
12923
12922
  if (!title) {
12924
- err('bunshin lessons add: --title is required (e.g. --title "Collections closes negative balances by hand")\n');
12923
+ err('bunshin lessons add: --title is required (e.g. --title "Legal releases held workspaces by hand")\n');
12925
12924
  return 1;
12926
12925
  }
12927
12926
  let content = str7(args.flags.content) ?? "";
@@ -13215,7 +13214,7 @@ Usage: bunshin <command> [options]
13215
13214
  reflect <transcript> [--session <id>] [--force] [--sync] [--json] (legacy lessons)
13216
13215
  recall --legacy "<task>" [--offline] legacy lesson recall
13217
13216
  conflict list [--json] | conflict resolve <id> "<answer>" [--note <n>]
13218
- demo run the synthetic APR scenario offline in a temporary store
13217
+ demo run a synthetic cross-team scenario offline in a temporary store
13219
13218
 
13220
13219
  hook <event> read hook JSON on stdin, write hook JSON on stdout
13221
13220
  events: session-start | user-prompt-submit | pre-tool-use |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bunshin-cc/bunshin",
3
- "version": "0.11.2",
3
+ "version": "0.11.3",
4
4
  "description": "Shared memory for company AI agents. Connect Codex, Claude Code, or Pi to Bunshin.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -15,13 +15,6 @@
15
15
  "engines": {
16
16
  "node": ">=20"
17
17
  },
18
- "scripts": {
19
- "build": "tsc -p tsconfig.json --noEmit && esbuild src/bin.ts --bundle --platform=node --target=node20 --format=esm --external:@anthropic-ai/sdk --external:yaml --outfile=dist/bin.js && esbuild src/git-remote-bunshin.ts --bundle --platform=node --target=node20 --format=esm --outfile=dist/git-remote-bunshin.js && esbuild ../../adapters/pi/index.ts --bundle --platform=node --target=node22 --format=esm --outfile=dist/pi-extension.js && node scripts/copy-mod.mjs",
20
- "dev": "tsx src/bin.ts",
21
- "test": "vitest run",
22
- "typecheck": "tsc -p tsconfig.json --noEmit",
23
- "prepack": "pnpm build"
24
- },
25
18
  "dependencies": {
26
19
  "@anthropic-ai/sdk": "^0.129.0",
27
20
  "yaml": "^2.8.0"
@@ -32,7 +25,7 @@
32
25
  "tsx": "^4.23.15",
33
26
  "typescript": "^7.0.2",
34
27
  "vitest": "^5.0.2",
35
- "@bunshin/core": "workspace:*"
28
+ "@bunshin/core": "0.1.0"
36
29
  },
37
30
  "license": "MIT",
38
31
  "homepage": "https://bunshin.cc",
@@ -55,5 +48,11 @@
55
48
  "claude-code",
56
49
  "memory",
57
50
  "knowledge"
58
- ]
59
- }
51
+ ],
52
+ "scripts": {
53
+ "build": "tsc -p tsconfig.json --noEmit && esbuild src/bin.ts --bundle --platform=node --target=node20 --format=esm --external:@anthropic-ai/sdk --external:yaml --outfile=dist/bin.js && esbuild src/git-remote-bunshin.ts --bundle --platform=node --target=node20 --format=esm --outfile=dist/git-remote-bunshin.js && esbuild ../../adapters/pi/index.ts --bundle --platform=node --target=node22 --format=esm --outfile=dist/pi-extension.js && node scripts/copy-mod.mjs",
54
+ "dev": "tsx src/bin.ts",
55
+ "test": "vitest run",
56
+ "typecheck": "tsc -p tsconfig.json --noEmit"
57
+ }
58
+ }