instar 1.3.442 → 1.3.444

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.
@@ -1 +1 @@
1
- {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/commands/server.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAaH,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAS3D,OAAO,EAAE,eAAe,EAAiC,MAAM,iCAAiC,CAAC;AAuBjG,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAGvD,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAiG7D,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AA6JtD,UAAU,YAAY;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;2DACuD;IACvD,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AA05BD,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,eAAe,EACzB,cAAc,EAAE,cAAc,EAC9B,YAAY,CAAC,EAAE,YAAY,EAC3B,WAAW,CAAC,EAAE,WAAW,EACzB,WAAW,CAAC,EAAE,WAAW,EACzB,iBAAiB,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,EAGvE,UAAU,CAAC,EAAE,MAAM,OAAO,8BAA8B,EAAE,WAAW,GAAG,IAAI,EAK5E,qBAAqB,CAAC,EAAE,MAAM,OAAO,gCAAgC,EAAE,kBAAkB,GAAG,IAAI,GAC/F,IAAI,CAyUN;AA2lBD,wBAAsB,WAAW,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAmrUtE;AAED,wBAAsB,UAAU,CAAC,OAAO,EAAE;IAAE,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CA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GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAsDzE;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,aAAa,CAAC,OAAO,EAAE;IAAE,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAuD5E"}
@@ -4221,7 +4221,7 @@ export async function startServer(options) {
4221
4221
  const slackCfg = slackConfig.config;
4222
4222
  const pgCfg = slackCfg.permissionGate;
4223
4223
  if (pgCfg && (pgCfg.observeOnly || pgCfg.enforce)) {
4224
- const { SlackPermissionObserver, SlackPrincipalResolver, SlackPermissionGate, PermissionDecisionLedger, RolePolicy, HeuristicIntentClassifier, HeuristicAnomalyScorer, MandateBackedGrantStore, } = await import('../permissions/index.js');
4224
+ const { SlackPermissionObserver, SlackPrincipalResolver, SlackPermissionGate, PermissionDecisionLedger, RolePolicy, HeuristicIntentClassifier, LlmIntentClassifier, HeuristicAnomalyScorer, MandateBackedGrantStore, } = await import('../permissions/index.js');
4225
4225
  // Own UserManager instance for verified-principal resolution (the
4226
4226
  // Telegram-block userManager is out of scope here). Reads users.json.
4227
4227
  const slackUserManager = new UserManager(config.stateDir, config.users);
@@ -4259,13 +4259,34 @@ export async function startServer(options) {
4259
4259
  console.warn('[slack] mandate-backed grant store wiring skipped:', ge.message);
4260
4260
  }
4261
4261
  }
4262
+ // ── Judgment-band classifier selection (opt-in, dark by default) ──
4263
+ // Default stays the deterministic HeuristicIntentClassifier. When
4264
+ // `permissionGate.classifier === 'llm'` AND an internal LLM provider is
4265
+ // available, use LlmIntentClassifier for the judgment band ABOVE the
4266
+ // deterministic floor — it fails CLOSED to the heuristic on any LLM
4267
+ // failure (never a silent allow). With 'llm' selected but no provider,
4268
+ // we stay on the heuristic and say so.
4269
+ let intentClassifier;
4270
+ if (pgCfg.classifier === 'llm') {
4271
+ if (sharedIntelligence) {
4272
+ intentClassifier = new LlmIntentClassifier({ intelligence: sharedIntelligence });
4273
+ console.log('[slack] permission gate using LLM judgment-band intent classifier (fail-closed to heuristic)');
4274
+ }
4275
+ else {
4276
+ intentClassifier = new HeuristicIntentClassifier();
4277
+ console.warn('[slack] permissionGate.classifier=llm requested but no intelligence provider available — staying on heuristic classifier');
4278
+ }
4279
+ }
4280
+ else {
4281
+ intentClassifier = new HeuristicIntentClassifier();
4282
+ }
4262
4283
  const observer = new SlackPermissionObserver({
4263
4284
  resolver: new SlackPrincipalResolver({
4264
4285
  resolveFromSlackUserId: (id) => slackUserManager.resolveFromSlackUserId(id),
4265
4286
  }),
4266
4287
  gate: new SlackPermissionGate({
4267
4288
  rolePolicy: new RolePolicy(),
4268
- classifier: new HeuristicIntentClassifier(),
4289
+ classifier: intentClassifier,
4269
4290
  anomalyScorer: new HeuristicAnomalyScorer(),
4270
4291
  grants: grantStore,
4271
4292
  }),
@@ -4279,6 +4300,40 @@ export async function startServer(options) {
4279
4300
  catch (e) {
4280
4301
  console.warn('[slack] permission gate wiring skipped:', e.message);
4281
4302
  }
4303
+ // ── Ambient "should I speak?" gate (considered/ambient mode, §5.2) — DARK ──
4304
+ // Attached ONLY when at least one channel is explicitly opted into proactive
4305
+ // contribution (`ambientContribution.enabledChannelIds` non-empty). With no
4306
+ // such config, no gate is attached and undirected messages drop exactly as
4307
+ // today (mention-only). The gate can only ever make the agent quieter
4308
+ // (fail-to-silence): no LLM provider / error / low confidence / rate-limit →
4309
+ // stay silent.
4310
+ try {
4311
+ const slackCfg = slackConfig.config;
4312
+ const amCfg = slackCfg.ambientContribution;
4313
+ if (amCfg && Array.isArray(amCfg.enabledChannelIds) && amCfg.enabledChannelIds.length > 0) {
4314
+ const { AmbientContributionGate } = await import('../permissions/index.js');
4315
+ const ambientGate = new AmbientContributionGate({
4316
+ config: {
4317
+ enabledChannelIds: amCfg.enabledChannelIds,
4318
+ maxProactivePerChannel: amCfg.maxProactivePerChannel,
4319
+ windowMs: amCfg.windowMs,
4320
+ minConfidence: amCfg.minConfidence,
4321
+ },
4322
+ // No provider ⇒ the gate stays silent for every message (fail-to-silence).
4323
+ intelligence: sharedIntelligence ?? undefined,
4324
+ onDecision: (decision, channelId) => {
4325
+ if (decision.speak) {
4326
+ console.log(`[slack] ambient gate: SPEAK in ${channelId} (${decision.reason})`);
4327
+ }
4328
+ },
4329
+ });
4330
+ slackAdapter.setAmbientGate(ambientGate);
4331
+ console.log(`[slack] ambient contribution gate attached for ${amCfg.enabledChannelIds.length} channel(s)${sharedIntelligence ? '' : ' (no LLM provider — gate stays silent)'}`);
4332
+ }
4333
+ }
4334
+ catch (e) {
4335
+ console.warn('[slack] ambient gate wiring skipped:', e.message);
4336
+ }
4282
4337
  // Wire message handler — inject Slack messages into sessions
4283
4338
  slackAdapter.onMessage(async (message) => {
4284
4339
  const channelId = message.channel.identifier;