getprismo 0.1.63 → 0.1.64

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.
@@ -135,6 +135,33 @@ module.exports = function createAgent(deps) {
135
135
  return path.join(path.resolve(rootDir || process.cwd()), ".prismo", "enforce-state.json");
136
136
  }
137
137
 
138
+ function policySnapshotPath(rootDir) {
139
+ return path.join(path.resolve(rootDir || process.cwd()), ".prismo", "control-policies.json");
140
+ }
141
+
142
+ async function syncControlPolicies(config, rootDir, options = {}) {
143
+ const endpoint = options.policiesEndpoint || `${apiBase(config)}/v1/dev/workspace/policies/agent`;
144
+ try {
145
+ const response = await requestJson("GET", endpoint, config.token, null, options.timeoutMs || 8000);
146
+ const policies = Array.isArray(response.data?.policies) ? response.data.policies : [];
147
+ const outputPath = policySnapshotPath(rootDir);
148
+ fs.mkdirSync(path.dirname(outputPath), { recursive: true });
149
+ fs.writeFileSync(outputPath, `${JSON.stringify({
150
+ schemaVersion: 1,
151
+ syncedAt: new Date().toISOString(),
152
+ source: endpoint,
153
+ plan: response.data?.plan || "free",
154
+ policies,
155
+ }, null, 2)}\n`, "utf8");
156
+ return { synced: true, policies: policies.length, path: path.relative(rootDir, outputPath) };
157
+ } catch (error) {
158
+ return {
159
+ synced: false,
160
+ error: error && error.message ? error.message : String(error),
161
+ };
162
+ }
163
+ }
164
+
138
165
  function summarizeCommand(command) {
139
166
  const value = String(command || "").replace(/\s+/g, " ").trim();
140
167
  if (!value) return "a repeated command";
@@ -580,7 +607,9 @@ module.exports = function createAgent(deps) {
580
607
  // feed and loop/context publishing only need the slower sync cadence, so
581
608
  // gate them on syncTelemetry to avoid a burst of small writes every poll.
582
609
  const publishLive = options.syncTelemetry !== false;
610
+ let policySync = null;
583
611
  if (publishLive) {
612
+ policySync = await syncControlPolicies(config, rootDir, options);
584
613
  await sendLiveEvent(config, {
585
614
  eventId: `heartbeat-${repo.pathBasename}-${pollTime.slice(0, 16)}`,
586
615
  phase: "watching",
@@ -818,6 +847,7 @@ module.exports = function createAgent(deps) {
818
847
  autoDetect: autoDetectResult,
819
848
  planner: plannerResult,
820
849
  sync: syncResult,
850
+ policies: policySync,
821
851
  results,
822
852
  privacy: {
823
853
  rawPrompts: false,
@@ -988,6 +1018,7 @@ module.exports = function createAgent(deps) {
988
1018
  runAutoDetect,
989
1019
  sendHeartbeat,
990
1020
  sendLiveEvent,
1021
+ syncControlPolicies,
991
1022
  updateAction,
992
1023
  VALID_MODES,
993
1024
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "getprismo",
3
- "version": "0.1.63",
3
+ "version": "0.1.64",
4
4
  "description": "Local AI coding workflow scanner for Codex, Claude Code, Cursor, and token-waste diagnostics.",
5
5
  "license": "MIT",
6
6
  "homepage": "https://github.com/shanirsh/prismodev#readme",