@skaile/workspaces 0.44.0 → 0.45.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.
Files changed (44) hide show
  1. package/CHANGELOG.md +70 -0
  2. package/dist/{asset-feeds-EGSG4FUB.js → asset-feeds-AOZLZMDV.js} +2 -2
  3. package/dist/{asset-feeds-EGSG4FUB.js.map → asset-feeds-AOZLZMDV.js.map} +1 -1
  4. package/dist/asset-manager/index.js +1 -1
  5. package/dist/asset-manager/src/index.d.ts +47 -0
  6. package/dist/asset-manager/src/index.d.ts.map +1 -1
  7. package/dist/{chunk-NHLXS2CH.js → chunk-JUZGLINM.js} +2 -2
  8. package/dist/{chunk-NHLXS2CH.js.map → chunk-JUZGLINM.js.map} +1 -1
  9. package/dist/{chunk-JUZLVRI4.js → chunk-L6BKSTAX.js} +71 -4
  10. package/dist/chunk-L6BKSTAX.js.map +1 -0
  11. package/dist/{chunk-7NQXVBCQ.js → chunk-LHUCCPH4.js} +2 -2
  12. package/dist/{chunk-7NQXVBCQ.js.map → chunk-LHUCCPH4.js.map} +1 -1
  13. package/dist/{chunk-5LHPKVGR.js → chunk-N2KV5RK3.js} +121 -4
  14. package/dist/chunk-N2KV5RK3.js.map +1 -0
  15. package/dist/cli/index.js +841 -553
  16. package/dist/cli/index.js.map +1 -1
  17. package/dist/cli/src/commands/asset-cmd.d.ts +1 -1
  18. package/dist/cli/src/commands/asset-cmd.d.ts.map +1 -1
  19. package/dist/cli/src/commands/catalog.d.ts +9 -3
  20. package/dist/cli/src/commands/catalog.d.ts.map +1 -1
  21. package/dist/cli/src/commands/library-cmd.d.ts.map +1 -1
  22. package/dist/cli/src/commands/skailify-lib.d.ts +108 -0
  23. package/dist/cli/src/commands/skailify-lib.d.ts.map +1 -0
  24. package/dist/core/index.js +1 -1
  25. package/dist/core/src/index.d.ts +1 -1
  26. package/dist/core/src/index.d.ts.map +1 -1
  27. package/dist/factory-assets/connectors/flow/run-flow.js +1 -1
  28. package/dist/factory-assets/skaile.manifest.yaml +3 -0
  29. package/dist/factory-assets/skills/skailify/SKILL.md +84 -0
  30. package/dist/{plugin-store-RBCDBO7K.js → plugin-store-2X2YXJVG.js} +2 -2
  31. package/dist/{plugin-store-RBCDBO7K.js.map → plugin-store-2X2YXJVG.js.map} +1 -1
  32. package/dist/runner/index.js +2 -2
  33. package/dist/runner/src/file-changed-coalescer.d.ts +48 -0
  34. package/dist/runner/src/file-changed-coalescer.d.ts.map +1 -0
  35. package/dist/runner/src/resources.d.ts.map +1 -1
  36. package/dist/sdk/asset-manager.js +1 -1
  37. package/dist/sdk/core.js +1 -1
  38. package/dist/sdk/index.js +2 -2
  39. package/dist/sdk/runner.js +2 -2
  40. package/dist/tui/index.js +2 -2
  41. package/dist/workspace-plugin/index.js +1 -1
  42. package/package.json +1 -1
  43. package/dist/chunk-5LHPKVGR.js.map +0 -1
  44. package/dist/chunk-JUZLVRI4.js.map +0 -1
@@ -1,4 +1,4 @@
1
- import { WorkspacePlugin } from './chunk-NHLXS2CH.js';
1
+ import { WorkspacePlugin } from './chunk-JUZGLINM.js';
2
2
  import { WebSocketServerTransport } from './chunk-WQ7DE5UC.js';
3
3
  import { assembleSystemPrompt, buildCapabilitiesPromptSection } from './chunk-W3UDISS2.js';
4
4
  import { PROTOCOL_VERSION } from './chunk-EVZKWY5J.js';
@@ -728,6 +728,115 @@ async function loadAgentManifest(agentDir) {
728
728
  return void 0;
729
729
  }
730
730
  }
731
+
732
+ // runner/src/file-changed-coalescer.ts
733
+ var DEFAULT_WINDOW_MS = 1e3;
734
+ var DEFAULT_THRESHOLD = 50;
735
+ var DEFAULT_MAX_DIRS = 256;
736
+ function isStructuralAction(action) {
737
+ return action === "create" || action === "delete";
738
+ }
739
+ function parentDirOf(path5) {
740
+ return path5.includes("/") ? path5.slice(0, path5.lastIndexOf("/")) : "";
741
+ }
742
+ var FileChangedCoalescer = class {
743
+ windowMs;
744
+ threshold;
745
+ maxDirs;
746
+ emit;
747
+ now;
748
+ log;
749
+ states = /* @__PURE__ */ new Map();
750
+ constructor(emit, options, now = Date.now, log = (m) => console.warn(m)) {
751
+ this.emit = emit;
752
+ this.windowMs = options?.windowMs ?? DEFAULT_WINDOW_MS;
753
+ this.threshold = options?.threshold ?? DEFAULT_THRESHOLD;
754
+ this.maxDirs = options?.maxDirs ?? DEFAULT_MAX_DIRS;
755
+ this.now = now;
756
+ this.log = log;
757
+ }
758
+ push(mountId, event) {
759
+ const t = this.now();
760
+ let state = this.states.get(mountId);
761
+ if (!state) {
762
+ state = {
763
+ lastEvent: t,
764
+ count: 0,
765
+ bursting: false,
766
+ dirs: /* @__PURE__ */ new Map(),
767
+ dirCapHit: false,
768
+ timer: null
769
+ };
770
+ this.states.set(mountId, state);
771
+ }
772
+ if (t - state.lastEvent > this.windowMs) {
773
+ this.flush(mountId, state);
774
+ state.count = 0;
775
+ }
776
+ state.lastEvent = t;
777
+ state.count += 1;
778
+ if (state.bursting) {
779
+ this.recordDir(state, event);
780
+ this.armFlush(mountId, state);
781
+ return;
782
+ }
783
+ if (state.count > this.threshold) {
784
+ state.bursting = true;
785
+ this.recordDir(state, event);
786
+ this.armFlush(mountId, state);
787
+ return;
788
+ }
789
+ this.emit(mountId, event);
790
+ }
791
+ /** Cancel timers and emit any pending representatives. Call on watcher teardown. */
792
+ dispose() {
793
+ for (const [mountId, state] of this.states) this.flush(mountId, state);
794
+ this.states.clear();
795
+ }
796
+ recordDir(state, event) {
797
+ const dir = parentDirOf(event.path);
798
+ let rep = state.dirs.get(dir);
799
+ if (!rep) {
800
+ if (state.dirs.size >= this.maxDirs) {
801
+ state.dirCapHit = true;
802
+ return;
803
+ }
804
+ rep = { first: event, structural: null };
805
+ state.dirs.set(dir, rep);
806
+ }
807
+ if (!rep.structural && isStructuralAction(event.action)) {
808
+ rep.structural = event;
809
+ }
810
+ }
811
+ armFlush(mountId, state) {
812
+ if (state.timer) clearTimeout(state.timer);
813
+ state.timer = setTimeout(() => {
814
+ const s = this.states.get(mountId);
815
+ if (s) this.flush(mountId, s);
816
+ }, this.windowMs);
817
+ state.timer.unref?.();
818
+ }
819
+ flush(mountId, state) {
820
+ if (state.timer) {
821
+ clearTimeout(state.timer);
822
+ state.timer = null;
823
+ }
824
+ if (state.bursting && state.dirs.size > 0) {
825
+ for (const rep of state.dirs.values()) {
826
+ this.emit(mountId, rep.structural ?? rep.first);
827
+ }
828
+ if (state.dirCapHit) {
829
+ this.log(
830
+ `[file-changed-coalescer] mount ${mountId}: burst touched more than ${this.maxDirs} directories; emitted ${this.maxDirs} per-dir events + a root fallback`
831
+ );
832
+ this.emit(mountId, { path: "", action: "edit", source: "filesystem" });
833
+ }
834
+ }
835
+ state.bursting = false;
836
+ state.dirs.clear();
837
+ state.dirCapHit = false;
838
+ }
839
+ };
731
840
  var RecipeUnavailableError = class extends Error {
732
841
  constructor(flakeRef, attr, cause) {
733
842
  super(
@@ -1422,10 +1531,17 @@ async function buildAgentResources(projectDir, driverType, _onLog, watch, secret
1422
1531
  }
1423
1532
  if (!resourceManager && driverType !== "claude-sdk" && !externalMcpManager?.hasServers() && !capabilityRegistry)
1424
1533
  return noopResult;
1534
+ let coalescer = null;
1425
1535
  const startWatching = () => {
1426
1536
  if (resourceManager && watch?.onFileChanged) {
1427
1537
  const dedupTtlMs = watch.dedupTtlMs ?? 500;
1428
1538
  const recentlyEmitted = /* @__PURE__ */ new Map();
1539
+ coalescer = new FileChangedCoalescer(
1540
+ (mountId, event) => watch.onFileChanged(mountId, event),
1541
+ void 0,
1542
+ Date.now,
1543
+ (m) => resLog.warn(m)
1544
+ );
1429
1545
  resourceManager.watchAll((connectorId, event) => {
1430
1546
  const dedupKey = `${connectorId}:${event.path}`;
1431
1547
  const now = Date.now();
@@ -1437,11 +1553,12 @@ async function buildAgentResources(projectDir, driverType, _onLog, watch, secret
1437
1553
  if (now - ts > dedupTtlMs) recentlyEmitted.delete(key);
1438
1554
  }
1439
1555
  }
1440
- watch.onFileChanged(connectorId, event);
1556
+ coalescer.push(connectorId, event);
1441
1557
  });
1442
1558
  }
1443
1559
  };
1444
1560
  const dispose = async () => {
1561
+ coalescer?.dispose();
1445
1562
  try {
1446
1563
  await externalMcpManager?.dispose();
1447
1564
  } catch {
@@ -5603,5 +5720,5 @@ function touchSession(state) {
5603
5720
  }
5604
5721
 
5605
5722
  export { CLAUDE_CODE_CREDENTIALS_KEY, COMPILE_MANIFEST_FILENAME, CapabilityRegistry, DEFAULT_CAPABILITY_CALL_TIMEOUT_MS, DEFAULT_COALESCE_MS, MarkdownStreamer, PreInitRingSink, agentDefinitionExists, bootstrapCapabilityRegistry, bootstrapRunnerLogStore, buildAgentResources, buildClientCapabilityHandler, buildContextSection, buildEnvironmentSection, buildResourcesAvailablePayload, builtinCapabilities, clearPreInitRingSink, clearSession, compileComposition, computeCapabilitySignature, createAgentSession, createSessionStimulusBus, defineCapability, deleteSession, dispatchRunnerCapabilityInvocation, emitSystemPromptComposed, ensureGitConfigInclude, extractClaudeAiOauthExpiresAt, getPreInitRingSink, handleMountResourceRequest, handleResourceRequest, installPreInitRingSink, listSessions, loadAgentManifest, loadCompileManifest, loadCompileManifestFromDir, loadSession, loadSessionById, mcpAuthSecretKey, newSession, registerCompositionCapabilities, rejectCapabilityOnApprovalDeny, resetRunnerLogStore, resolveAgentComposition, resolveAgentMixins, resolveBinding, resolveCapabilityCallTimeoutMs, resolveCapabilityResult, resolveComposition, resolveMixin, runAgentChat, saveSession, setCurrentSession, startAgentServer, touchSession, writeClaudeCodeCredentialsFile };
5606
- //# sourceMappingURL=chunk-5LHPKVGR.js.map
5607
- //# sourceMappingURL=chunk-5LHPKVGR.js.map
5723
+ //# sourceMappingURL=chunk-N2KV5RK3.js.map
5724
+ //# sourceMappingURL=chunk-N2KV5RK3.js.map