zeitlich 0.2.15 → 0.2.16

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 (64) hide show
  1. package/README.md +50 -0
  2. package/dist/adapters/sandbox/daytona/index.cjs +52 -23
  3. package/dist/adapters/sandbox/daytona/index.cjs.map +1 -1
  4. package/dist/adapters/sandbox/daytona/index.d.cts +10 -2
  5. package/dist/adapters/sandbox/daytona/index.d.ts +10 -2
  6. package/dist/adapters/sandbox/daytona/index.js +52 -23
  7. package/dist/adapters/sandbox/daytona/index.js.map +1 -1
  8. package/dist/adapters/sandbox/inmemory/index.cjs +21 -16
  9. package/dist/adapters/sandbox/inmemory/index.cjs.map +1 -1
  10. package/dist/adapters/sandbox/inmemory/index.d.cts +1 -1
  11. package/dist/adapters/sandbox/inmemory/index.d.ts +1 -1
  12. package/dist/adapters/sandbox/inmemory/index.js +21 -16
  13. package/dist/adapters/sandbox/inmemory/index.js.map +1 -1
  14. package/dist/adapters/sandbox/virtual/index.cjs +38 -38
  15. package/dist/adapters/sandbox/virtual/index.cjs.map +1 -1
  16. package/dist/adapters/sandbox/virtual/index.d.cts +6 -6
  17. package/dist/adapters/sandbox/virtual/index.d.ts +6 -6
  18. package/dist/adapters/sandbox/virtual/index.js +37 -37
  19. package/dist/adapters/sandbox/virtual/index.js.map +1 -1
  20. package/dist/adapters/thread/google-genai/index.d.cts +2 -2
  21. package/dist/adapters/thread/google-genai/index.d.ts +2 -2
  22. package/dist/adapters/thread/langchain/index.d.cts +2 -2
  23. package/dist/adapters/thread/langchain/index.d.ts +2 -2
  24. package/dist/index.cjs +2 -3
  25. package/dist/index.cjs.map +1 -1
  26. package/dist/index.d.cts +5 -5
  27. package/dist/index.d.ts +5 -5
  28. package/dist/index.js +2 -3
  29. package/dist/index.js.map +1 -1
  30. package/dist/{types-CDubRtad.d.cts → types-BMRzfELQ.d.cts} +2 -0
  31. package/dist/{types-CDubRtad.d.ts → types-BMRzfELQ.d.ts} +2 -0
  32. package/dist/{types-CwwgQ_9H.d.ts → types-BSOte_8s.d.ts} +6 -2
  33. package/dist/{types-BVP87m_W.d.cts → types-DCi2qXjN.d.cts} +6 -2
  34. package/dist/{types-Dje1TdH6.d.cts → types-Drli9aCK.d.cts} +1 -1
  35. package/dist/{types-BWvIYK28.d.ts → types-XPtivmSJ.d.ts} +1 -1
  36. package/dist/workflow.cjs +2 -3
  37. package/dist/workflow.cjs.map +1 -1
  38. package/dist/workflow.d.cts +6 -6
  39. package/dist/workflow.d.ts +6 -6
  40. package/dist/workflow.js +2 -3
  41. package/dist/workflow.js.map +1 -1
  42. package/package.json +1 -1
  43. package/src/adapters/sandbox/daytona/filesystem.ts +43 -19
  44. package/src/adapters/sandbox/daytona/index.ts +16 -3
  45. package/src/adapters/sandbox/daytona/types.ts +4 -0
  46. package/src/adapters/sandbox/inmemory/index.ts +22 -16
  47. package/src/adapters/sandbox/virtual/filesystem.ts +29 -31
  48. package/src/adapters/sandbox/virtual/index.ts +5 -3
  49. package/src/adapters/sandbox/virtual/provider.ts +5 -2
  50. package/src/adapters/sandbox/virtual/types.ts +3 -0
  51. package/src/adapters/sandbox/virtual/with-virtual-sandbox.ts +4 -3
  52. package/src/lib/sandbox/tree.integration.test.ts +153 -0
  53. package/src/lib/sandbox/types.ts +2 -0
  54. package/src/lib/session/session-edge-cases.integration.test.ts +962 -0
  55. package/src/lib/session/session.integration.test.ts +852 -0
  56. package/src/lib/session/session.ts +5 -4
  57. package/src/lib/skills/skills.integration.test.ts +308 -0
  58. package/src/lib/state/manager.integration.test.ts +342 -0
  59. package/src/lib/subagent/subagent.integration.test.ts +467 -0
  60. package/src/lib/thread/id.test.ts +50 -0
  61. package/src/lib/tool-router/auto-append-sandbox.integration.test.ts +344 -0
  62. package/src/lib/tool-router/router-edge-cases.integration.test.ts +623 -0
  63. package/src/lib/tool-router/router.integration.test.ts +699 -0
  64. package/src/lib/types.test.ts +29 -0
@@ -20,6 +20,8 @@ interface FileStat {
20
20
  * {@link SandboxNotSupportedError}.
21
21
  */
22
22
  interface SandboxFileSystem {
23
+ /** Base directory used when resolving relative paths. */
24
+ readonly workspaceBase: string;
23
25
  readFile(path: string): Promise<string>;
24
26
  readFileBuffer(path: string): Promise<Uint8Array>;
25
27
  writeFile(path: string, content: string | Uint8Array): Promise<void>;
@@ -20,6 +20,8 @@ interface FileStat {
20
20
  * {@link SandboxNotSupportedError}.
21
21
  */
22
22
  interface SandboxFileSystem {
23
+ /** Base directory used when resolving relative paths. */
24
+ readonly workspaceBase: string;
23
25
  readFile(path: string): Promise<string>;
24
26
  readFileBuffer(path: string): Promise<Uint8Array>;
25
27
  writeFile(path: string, content: string | Uint8Array): Promise<void>;
@@ -1,4 +1,4 @@
1
- import { a as SandboxFileSystem, F as FileStat, D as DirentEntry, S as Sandbox, d as SandboxCreateOptions } from './types-CDubRtad.js';
1
+ import { a as SandboxFileSystem, F as FileStat, D as DirentEntry, S as Sandbox, d as SandboxCreateOptions } from './types-BMRzfELQ.js';
2
2
  import { R as RouterContext } from './types-BMXzv7TN.js';
3
3
 
4
4
  /**
@@ -11,10 +11,11 @@ import { R as RouterContext } from './types-BMXzv7TN.js';
11
11
  declare class VirtualSandboxFileSystem<TCtx = unknown, TMeta = FileEntryMetadata> implements SandboxFileSystem {
12
12
  private resolver;
13
13
  private ctx;
14
+ readonly workspaceBase: string;
14
15
  private entries;
15
16
  private directories;
16
17
  private mutations;
17
- constructor(tree: FileEntry<TMeta>[], resolver: FileResolver<TCtx, TMeta>, ctx: TCtx);
18
+ constructor(tree: FileEntry<TMeta>[], resolver: FileResolver<TCtx, TMeta>, ctx: TCtx, workspaceBase?: string);
18
19
  /** Return all mutations accumulated during this invocation. */
19
20
  getMutations(): TreeMutation<TMeta>[];
20
21
  /** Look up a file entry by virtual path. */
@@ -93,6 +94,8 @@ interface FileResolver<TCtx = unknown, TMeta = FileEntryMetadata> {
93
94
  */
94
95
  interface VirtualSandboxCreateOptions<TCtx> extends SandboxCreateOptions {
95
96
  resolverContext: TCtx;
97
+ /** Base path for resolving relative filesystem paths (default "/"). */
98
+ workspaceBase?: string;
96
99
  }
97
100
  /**
98
101
  * The portion of workflow `AgentState` that the virtual sandbox reads via
@@ -103,6 +106,7 @@ interface VirtualSandboxState<TCtx = unknown, TMeta = FileEntryMetadata> {
103
106
  sandboxId: string;
104
107
  fileTree: FileEntry<TMeta>[];
105
108
  resolverContext: TCtx;
109
+ workspaceBase?: string;
106
110
  }
107
111
  /**
108
112
  * A {@link Sandbox} whose filesystem is backed by a {@link VirtualSandboxFileSystem}.
@@ -1,4 +1,4 @@
1
- import { a as SandboxFileSystem, F as FileStat, D as DirentEntry, S as Sandbox, d as SandboxCreateOptions } from './types-CDubRtad.cjs';
1
+ import { a as SandboxFileSystem, F as FileStat, D as DirentEntry, S as Sandbox, d as SandboxCreateOptions } from './types-BMRzfELQ.cjs';
2
2
  import { R as RouterContext } from './types-BMXzv7TN.cjs';
3
3
 
4
4
  /**
@@ -11,10 +11,11 @@ import { R as RouterContext } from './types-BMXzv7TN.cjs';
11
11
  declare class VirtualSandboxFileSystem<TCtx = unknown, TMeta = FileEntryMetadata> implements SandboxFileSystem {
12
12
  private resolver;
13
13
  private ctx;
14
+ readonly workspaceBase: string;
14
15
  private entries;
15
16
  private directories;
16
17
  private mutations;
17
- constructor(tree: FileEntry<TMeta>[], resolver: FileResolver<TCtx, TMeta>, ctx: TCtx);
18
+ constructor(tree: FileEntry<TMeta>[], resolver: FileResolver<TCtx, TMeta>, ctx: TCtx, workspaceBase?: string);
18
19
  /** Return all mutations accumulated during this invocation. */
19
20
  getMutations(): TreeMutation<TMeta>[];
20
21
  /** Look up a file entry by virtual path. */
@@ -93,6 +94,8 @@ interface FileResolver<TCtx = unknown, TMeta = FileEntryMetadata> {
93
94
  */
94
95
  interface VirtualSandboxCreateOptions<TCtx> extends SandboxCreateOptions {
95
96
  resolverContext: TCtx;
97
+ /** Base path for resolving relative filesystem paths (default "/"). */
98
+ workspaceBase?: string;
96
99
  }
97
100
  /**
98
101
  * The portion of workflow `AgentState` that the virtual sandbox reads via
@@ -103,6 +106,7 @@ interface VirtualSandboxState<TCtx = unknown, TMeta = FileEntryMetadata> {
103
106
  sandboxId: string;
104
107
  fileTree: FileEntry<TMeta>[];
105
108
  resolverContext: TCtx;
109
+ workspaceBase?: string;
106
110
  }
107
111
  /**
108
112
  * A {@link Sandbox} whose filesystem is backed by a {@link VirtualSandboxFileSystem}.
@@ -1,7 +1,7 @@
1
1
  import { Duration } from '@temporalio/common';
2
2
  import { a as ToolMap, b as ToolRouterHooks, M as MessageContent, S as SessionExitReason, c as ToolHandlerResponse, P as PreToolUseHookResult, d as PostToolUseFailureHookResult, e as RawToolCall, f as TokenUsage, B as BaseAgentState, g as RunAgentConfig, h as AgentStatus, W as WorkflowTask, i as ToolDefinition, j as ToolResultConfig, k as ToolCallResultUnion, I as InferToolResults } from './types-BMXzv7TN.cjs';
3
3
  import { z } from 'zod';
4
- import { g as SandboxOps } from './types-CDubRtad.cjs';
4
+ import { g as SandboxOps } from './types-BMRzfELQ.cjs';
5
5
  import { QueryDefinition } from '@temporalio/workflow';
6
6
  import { UpdateDefinition } from '@temporalio/common/lib/interfaces';
7
7
 
@@ -1,7 +1,7 @@
1
1
  import { Duration } from '@temporalio/common';
2
2
  import { a as ToolMap, b as ToolRouterHooks, M as MessageContent, S as SessionExitReason, c as ToolHandlerResponse, P as PreToolUseHookResult, d as PostToolUseFailureHookResult, e as RawToolCall, f as TokenUsage, B as BaseAgentState, g as RunAgentConfig, h as AgentStatus, W as WorkflowTask, i as ToolDefinition, j as ToolResultConfig, k as ToolCallResultUnion, I as InferToolResults } from './types-BMXzv7TN.js';
3
3
  import { z } from 'zod';
4
- import { g as SandboxOps } from './types-CDubRtad.js';
4
+ import { g as SandboxOps } from './types-BMRzfELQ.js';
5
5
  import { QueryDefinition } from '@temporalio/workflow';
6
6
  import { UpdateDefinition } from '@temporalio/common/lib/interfaces';
7
7
 
package/dist/workflow.cjs CHANGED
@@ -559,9 +559,7 @@ var createSession = async ({
559
559
  const result = await sandboxOps.createSandbox({ id: threadId });
560
560
  sandboxId = result.sandboxId;
561
561
  if (result.stateUpdate) {
562
- stateManager.mergeUpdate(
563
- result.stateUpdate
564
- );
562
+ stateManager.mergeUpdate(result.stateUpdate);
565
563
  }
566
564
  }
567
565
  if (hooks.onSessionStart) {
@@ -646,6 +644,7 @@ var createSession = async ({
646
644
  );
647
645
  if (!conditionMet) {
648
646
  stateManager.cancel();
647
+ exitReason = "cancelled";
649
648
  await workflow.condition(() => false, "2s");
650
649
  break;
651
650
  }