@bolt-foundry/gambit 0.5.3-dev.1 → 0.6.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.
- package/CHANGELOG.md +21 -1
- package/bin/gambit.cjs +214 -0
- package/esm/_dnt.polyfills.d.ts +82 -6
- package/esm/_dnt.polyfills.d.ts.map +1 -1
- package/esm/_dnt.polyfills.js +127 -1
- package/esm/deps/jsr.io/@std/path/1.1.4/constants.d.ts +1 -1
- package/esm/deps/jsr.io/@std/path/1.1.4/posix/constants.d.ts.map +1 -1
- package/esm/deps/jsr.io/@std/path/1.1.4/windows/constants.d.ts.map +1 -1
- package/{simulator-ui → esm/gambit/simulator-ui/dist}/bundle.js +253 -120
- package/{simulator-ui → esm/gambit/simulator-ui/dist}/bundle.js.map +4 -4
- package/esm/mod.d.ts +53 -0
- package/esm/mod.d.ts.map +1 -0
- package/esm/mod.js +22 -0
- package/esm/packages/gambit-core/mod.d.ts.map +1 -0
- package/esm/packages/gambit-core/src/definitions.d.ts.map +1 -0
- package/esm/packages/gambit-core/src/openai_compat.d.ts.map +1 -0
- package/esm/packages/gambit-core/src/providers/openrouter.d.ts.map +1 -0
- package/esm/{gambit-core → packages/gambit-core}/src/providers/openrouter.js +1 -1
- package/esm/packages/gambit-core/src/render.d.ts.map +1 -0
- package/esm/packages/gambit-core/src/schema.d.ts.map +1 -0
- package/esm/src/durable_streams.d.ts.map +1 -0
- package/esm/{gambit/src → src}/server.d.ts +4 -1
- package/esm/src/server.d.ts.map +1 -0
- package/esm/{gambit/src → src}/server.js +26 -12
- package/esm/src/test_bot.d.ts.map +1 -0
- package/esm/src/trace.d.ts.map +1 -0
- package/esm/{gambit/src → src}/trace.js +2 -2
- package/package.json +10 -6
- package/script/_dnt.polyfills.d.ts +82 -6
- package/script/_dnt.polyfills.d.ts.map +1 -1
- package/script/_dnt.polyfills.js +128 -0
- package/script/deps/jsr.io/@std/internal/1.0.12/_os.js +17 -7
- package/script/deps/jsr.io/@std/path/1.1.4/constants.d.ts +1 -1
- package/script/deps/jsr.io/@std/path/1.1.4/posix/constants.d.ts.map +1 -1
- package/script/deps/jsr.io/@std/path/1.1.4/posix/resolve.js +17 -7
- package/script/deps/jsr.io/@std/path/1.1.4/windows/constants.d.ts.map +1 -1
- package/script/deps/jsr.io/@std/path/1.1.4/windows/resolve.js +17 -7
- package/script/gambit/simulator-ui/dist/.gitkeep +1 -0
- package/script/gambit/simulator-ui/dist/bundle.js +22957 -0
- package/script/gambit/simulator-ui/dist/bundle.js.map +7 -0
- package/script/mod.d.ts +53 -0
- package/script/mod.d.ts.map +1 -0
- package/script/mod.js +33 -0
- package/script/packages/gambit-core/mod.d.ts.map +1 -0
- package/script/packages/gambit-core/src/definitions.d.ts.map +1 -0
- package/script/packages/gambit-core/src/openai_compat.d.ts.map +1 -0
- package/script/packages/gambit-core/src/providers/openrouter.d.ts.map +1 -0
- package/script/{gambit-core → packages/gambit-core}/src/providers/openrouter.js +18 -8
- package/script/packages/gambit-core/src/render.d.ts.map +1 -0
- package/script/packages/gambit-core/src/schema.d.ts.map +1 -0
- package/script/src/durable_streams.d.ts.map +1 -0
- package/script/{gambit/src → src}/server.d.ts +4 -1
- package/script/src/server.d.ts.map +1 -0
- package/script/{gambit/src → src}/server.js +43 -19
- package/script/src/test_bot.d.ts.map +1 -0
- package/script/src/trace.d.ts.map +1 -0
- package/script/{gambit/src → src}/trace.js +19 -9
- package/esm/gambit/mod.d.ts +0 -10
- package/esm/gambit/mod.d.ts.map +0 -1
- package/esm/gambit/mod.js +0 -9
- package/esm/gambit/src/durable_streams.d.ts.map +0 -1
- package/esm/gambit/src/server.d.ts.map +0 -1
- package/esm/gambit/src/test_bot.d.ts.map +0 -1
- package/esm/gambit/src/trace.d.ts.map +0 -1
- package/esm/gambit-core/mod.d.ts.map +0 -1
- package/esm/gambit-core/src/definitions.d.ts.map +0 -1
- package/esm/gambit-core/src/openai_compat.d.ts.map +0 -1
- package/esm/gambit-core/src/providers/openrouter.d.ts.map +0 -1
- package/esm/gambit-core/src/render.d.ts.map +0 -1
- package/esm/gambit-core/src/schema.d.ts.map +0 -1
- package/script/gambit/mod.d.ts +0 -10
- package/script/gambit/mod.d.ts.map +0 -1
- package/script/gambit/mod.js +0 -27
- package/script/gambit/src/durable_streams.d.ts.map +0 -1
- package/script/gambit/src/server.d.ts.map +0 -1
- package/script/gambit/src/test_bot.d.ts.map +0 -1
- package/script/gambit/src/trace.d.ts.map +0 -1
- package/script/gambit-core/mod.d.ts.map +0 -1
- package/script/gambit-core/src/definitions.d.ts.map +0 -1
- package/script/gambit-core/src/openai_compat.d.ts.map +0 -1
- package/script/gambit-core/src/providers/openrouter.d.ts.map +0 -1
- package/script/gambit-core/src/render.d.ts.map +0 -1
- package/script/gambit-core/src/schema.d.ts.map +0 -1
- /package/{simulator-ui → esm/gambit/simulator-ui/dist}/.gitkeep +0 -0
- /package/esm/{gambit-core → packages/gambit-core}/mod.d.ts +0 -0
- /package/esm/{gambit-core → packages/gambit-core}/mod.js +0 -0
- /package/esm/{gambit-core → packages/gambit-core}/src/definitions.d.ts +0 -0
- /package/esm/{gambit-core → packages/gambit-core}/src/definitions.js +0 -0
- /package/esm/{gambit-core → packages/gambit-core}/src/openai_compat.d.ts +0 -0
- /package/esm/{gambit-core → packages/gambit-core}/src/openai_compat.js +0 -0
- /package/esm/{gambit-core → packages/gambit-core}/src/providers/openrouter.d.ts +0 -0
- /package/esm/{gambit-core → packages/gambit-core}/src/render.d.ts +0 -0
- /package/esm/{gambit-core → packages/gambit-core}/src/render.js +0 -0
- /package/esm/{gambit-core → packages/gambit-core}/src/schema.d.ts +0 -0
- /package/esm/{gambit-core → packages/gambit-core}/src/schema.js +0 -0
- /package/esm/{gambit/src → src}/durable_streams.d.ts +0 -0
- /package/esm/{gambit/src → src}/durable_streams.js +0 -0
- /package/esm/{gambit/src → src}/test_bot.d.ts +0 -0
- /package/esm/{gambit/src → src}/test_bot.js +0 -0
- /package/esm/{gambit/src → src}/trace.d.ts +0 -0
- /package/script/{gambit-core → packages/gambit-core}/mod.d.ts +0 -0
- /package/script/{gambit-core → packages/gambit-core}/mod.js +0 -0
- /package/script/{gambit-core → packages/gambit-core}/src/definitions.d.ts +0 -0
- /package/script/{gambit-core → packages/gambit-core}/src/definitions.js +0 -0
- /package/script/{gambit-core → packages/gambit-core}/src/openai_compat.d.ts +0 -0
- /package/script/{gambit-core → packages/gambit-core}/src/openai_compat.js +0 -0
- /package/script/{gambit-core → packages/gambit-core}/src/providers/openrouter.d.ts +0 -0
- /package/script/{gambit-core → packages/gambit-core}/src/render.d.ts +0 -0
- /package/script/{gambit-core → packages/gambit-core}/src/render.js +0 -0
- /package/script/{gambit-core → packages/gambit-core}/src/schema.d.ts +0 -0
- /package/script/{gambit-core → packages/gambit-core}/src/schema.js +0 -0
- /package/script/{gambit/src → src}/durable_streams.d.ts +0 -0
- /package/script/{gambit/src → src}/durable_streams.js +0 -0
- /package/script/{gambit/src → src}/test_bot.d.ts +0 -0
- /package/script/{gambit/src → src}/test_bot.js +0 -0
- /package/script/{gambit/src → src}/trace.d.ts +0 -0
package/esm/mod.d.ts
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Gambit exports for authoring and running decks/cards with runtime helpers.
|
|
3
|
+
*
|
|
4
|
+
* @module
|
|
5
|
+
*/
|
|
6
|
+
/** Define a reusable card with shared behavior, tools, or guardrails. */
|
|
7
|
+
import "./_dnt.polyfills.js";
|
|
8
|
+
export { defineCard } from "./packages/gambit-core/mod.js";
|
|
9
|
+
/** Define a deck, the primary unit of execution. */
|
|
10
|
+
export { defineDeck } from "./packages/gambit-core/mod.js";
|
|
11
|
+
/** Action deck definition shape. */
|
|
12
|
+
export type { ActionDeckDefinition } from "./packages/gambit-core/mod.js";
|
|
13
|
+
/** Card definition shape. */
|
|
14
|
+
export type { CardDefinition } from "./packages/gambit-core/mod.js";
|
|
15
|
+
/** Deck definition shape. */
|
|
16
|
+
export type { DeckDefinition } from "./packages/gambit-core/mod.js";
|
|
17
|
+
/** Reference to another deck. */
|
|
18
|
+
export type { DeckReferenceDefinition } from "./packages/gambit-core/mod.js";
|
|
19
|
+
/** Execution context passed to decks. */
|
|
20
|
+
export type { ExecutionContext } from "./packages/gambit-core/mod.js";
|
|
21
|
+
/** Grader deck definition shape. */
|
|
22
|
+
export type { GraderDeckDefinition } from "./packages/gambit-core/mod.js";
|
|
23
|
+
/** Guardrails definition and hooks. */
|
|
24
|
+
export type { Guardrails } from "./packages/gambit-core/mod.js";
|
|
25
|
+
/** JSON-serializable value type used throughout Gambit. */
|
|
26
|
+
export type { JSONValue } from "./packages/gambit-core/mod.js";
|
|
27
|
+
/** Model provider interface for LLM backends. */
|
|
28
|
+
export type { ModelProvider } from "./packages/gambit-core/mod.js";
|
|
29
|
+
/** Test deck definition shape. */
|
|
30
|
+
export type { TestDeckDefinition } from "./packages/gambit-core/mod.js";
|
|
31
|
+
/** Check if a value is an explicit end-of-run signal. */
|
|
32
|
+
export { isGambitEndSignal } from "./packages/gambit-core/mod.js";
|
|
33
|
+
/** Run a deck and return its execution result. */
|
|
34
|
+
export { runDeck } from "./packages/gambit-core/mod.js";
|
|
35
|
+
/** Signal for explicitly ending a Gambit run. */
|
|
36
|
+
export type { GambitEndSignal } from "./packages/gambit-core/mod.js";
|
|
37
|
+
/** OpenAI Chat Completions compatibility helper for a deck. */
|
|
38
|
+
export { chatCompletionsWithDeck } from "./packages/gambit-core/mod.js";
|
|
39
|
+
/** OpenAI-compatible request payload. */
|
|
40
|
+
export type { ChatCompletionsRequest } from "./packages/gambit-core/mod.js";
|
|
41
|
+
/** OpenAI-compatible response payload. */
|
|
42
|
+
export type { ChatCompletionsResponse } from "./packages/gambit-core/mod.js";
|
|
43
|
+
/** Render a deck to a human-readable outline or debug view. */
|
|
44
|
+
export { renderDeck } from "./packages/gambit-core/mod.js";
|
|
45
|
+
/** Options for deck rendering. */
|
|
46
|
+
export type { RenderDeckOptions } from "./packages/gambit-core/mod.js";
|
|
47
|
+
/** Result data from rendering a deck. */
|
|
48
|
+
export type { RenderDeckResult } from "./packages/gambit-core/mod.js";
|
|
49
|
+
/** Provider factory for OpenRouter-backed model calls. */
|
|
50
|
+
export { createOpenRouterProvider } from "./packages/gambit-core/mod.js";
|
|
51
|
+
/** Start the WebSocket simulator server for the Gambit UI. */
|
|
52
|
+
export { startWebSocketSimulator } from "./src/server.js";
|
|
53
|
+
//# sourceMappingURL=mod.d.ts.map
|
package/esm/mod.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../src/mod.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,yEAAyE;AACzE,OAAO,qBAAqB,CAAC;AAE7B,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAC3D,oDAAoD;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAC3D,oCAAoC;AACpC,YAAY,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AAC1E,6BAA6B;AAC7B,YAAY,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AACpE,6BAA6B;AAC7B,YAAY,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AACpE,iCAAiC;AACjC,YAAY,EAAE,uBAAuB,EAAE,MAAM,+BAA+B,CAAC;AAC7E,yCAAyC;AACzC,YAAY,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACtE,oCAAoC;AACpC,YAAY,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AAC1E,uCAAuC;AACvC,YAAY,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAChE,2DAA2D;AAC3D,YAAY,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAC/D,iDAAiD;AACjD,YAAY,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AACnE,kCAAkC;AAClC,YAAY,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AACxE,yDAAyD;AACzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAClE,kDAAkD;AAClD,OAAO,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AACxD,iDAAiD;AACjD,YAAY,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AACrE,+DAA+D;AAC/D,OAAO,EAAE,uBAAuB,EAAE,MAAM,+BAA+B,CAAC;AACxE,yCAAyC;AACzC,YAAY,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AAC5E,0CAA0C;AAC1C,YAAY,EAAE,uBAAuB,EAAE,MAAM,+BAA+B,CAAC;AAC7E,+DAA+D;AAC/D,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAC3D,kCAAkC;AAClC,YAAY,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AACvE,yCAAyC;AACzC,YAAY,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACtE,0DAA0D;AAC1D,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AACzE,8DAA8D;AAC9D,OAAO,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAC"}
|
package/esm/mod.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Gambit exports for authoring and running decks/cards with runtime helpers.
|
|
3
|
+
*
|
|
4
|
+
* @module
|
|
5
|
+
*/
|
|
6
|
+
/** Define a reusable card with shared behavior, tools, or guardrails. */
|
|
7
|
+
import "./_dnt.polyfills.js";
|
|
8
|
+
export { defineCard } from "./packages/gambit-core/mod.js";
|
|
9
|
+
/** Define a deck, the primary unit of execution. */
|
|
10
|
+
export { defineDeck } from "./packages/gambit-core/mod.js";
|
|
11
|
+
/** Check if a value is an explicit end-of-run signal. */
|
|
12
|
+
export { isGambitEndSignal } from "./packages/gambit-core/mod.js";
|
|
13
|
+
/** Run a deck and return its execution result. */
|
|
14
|
+
export { runDeck } from "./packages/gambit-core/mod.js";
|
|
15
|
+
/** OpenAI Chat Completions compatibility helper for a deck. */
|
|
16
|
+
export { chatCompletionsWithDeck } from "./packages/gambit-core/mod.js";
|
|
17
|
+
/** Render a deck to a human-readable outline or debug view. */
|
|
18
|
+
export { renderDeck } from "./packages/gambit-core/mod.js";
|
|
19
|
+
/** Provider factory for OpenRouter-backed model calls. */
|
|
20
|
+
export { createOpenRouterProvider } from "./packages/gambit-core/mod.js";
|
|
21
|
+
/** Start the WebSocket simulator server for the Gambit UI. */
|
|
22
|
+
export { startWebSocketSimulator } from "./src/server.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../../src/packages/gambit-core/mod.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,yEAAyE;AACzE,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,oDAAoD;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,oCAAoC;AACpC,YAAY,EAAE,oBAAoB,EAAE,MAAM,0CAA0C,CAAC;AACrF,6BAA6B;AAC7B,YAAY,EAAE,cAAc,EAAE,MAAM,0CAA0C,CAAC;AAC/E,6BAA6B;AAC7B,YAAY,EAAE,cAAc,EAAE,MAAM,0CAA0C,CAAC;AAC/E,iCAAiC;AACjC,YAAY,EAAE,uBAAuB,EAAE,MAAM,0CAA0C,CAAC;AACxF,yCAAyC;AACzC,YAAY,EAAE,gBAAgB,EAAE,MAAM,0CAA0C,CAAC;AACjF,oCAAoC;AACpC,YAAY,EAAE,oBAAoB,EAAE,MAAM,0CAA0C,CAAC;AACrF,uCAAuC;AACvC,YAAY,EAAE,UAAU,EAAE,MAAM,0CAA0C,CAAC;AAC3E,2DAA2D;AAC3D,YAAY,EAAE,SAAS,EAAE,MAAM,0CAA0C,CAAC;AAC1E,iDAAiD;AACjD,YAAY,EAAE,a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EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACxC,GAAG,OAAO,CAAC,uBAAuB,CAAC,CAsJnC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"openrouter.d.ts","sourceRoot":"","sources":["../../../../../src/packages/gambit-core/src/providers/openrouter.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAGV,aAAa,EAEd,MAAM,0CAA0C,CAAC;AAwBlD,wBAAgB,wBAAwB,CAAC,IAAI,EAAE;IAC7C,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,GAAG,aAAa,CAqLhB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../../../../src/packages/gambit-core/src/render.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAe,cAAc,EAAE,MAAM,0CAA0C,CAAC;AAE1G,eAAO,MAAM,MAAM,SAAU,CAAC;AAE9B,MAAM,MAAM,4BAA4B,GAAG;IACzC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,KAAK,CAAC;QACd,IAAI,EAAE,QAAQ,GAAG,MAAM,GAAG,WAAW,GAAG,MAAM,CAAC;QAC/C,OAAO,EACH,MAAM,GACN,IAAI,GACJ,KAAK,CAAC,MAAM,GAAG;YAAE,IAAI,CAAC,EAAE,MAAM,CAAC;YAAC,IAAI,CAAC,EAAE,MAAM,CAAA;SAAE,CAAC,CAAC;QACrD,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,YAAY,CAAC,EAAE,MAAM,CAAC;QACtB,UAAU,CAAC,EAAE,YAAY,CAAC,YAAY,CAAC,CAAC;KACzC,CAAC,CAAC;IACH,KAAK,CAAC,EAAE,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O,CAAC,gBAAgB,CAAC,CA0E3B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../../src/packages/gambit-core/src/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,0CAA0C,CAAC;AAC1E,OAAO,KAAK,EAA0B,UAAU,EAAE,MAAM,KAAK,CAAC;AAE9D,wBAAgB,kBAAkB,CAAC,CAAC,EAClC,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EACpB,KAAK,EAAE,OAAO,GACb,CAAC,CAUH;AAED,wBAAgB,YAAY,CAAC,MAAM,EAAE,CAAC,CAAC,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAO5E;AAED,wBAAgB,eAAe,CAC7B,KAAK,EAAE,OAAO,EACd,KAAK,EAAE,MAAM,GACZ,OAAO,CAAC,KAAK,IAAI,CAAC,CAAC,UAAU,CAQ/B;AAED,wBAAgB,eAAe,CAC7B,IAAI,EAAE,UAAU,GAAG,SAAS,EAC5B,QAAQ,EAAE,UAAU,GAAG,SAAS,GAC/B,UAAU,GAAG,SAAS,CAOxB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"durable_streams.d.ts","sourceRoot":"","sources":["../../src/src/durable_streams.ts"],"names":[],"mappings":"AAAA,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,OAAO,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAsCF,wBAAgB,wBAAwB,CACtC,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,OAAO,GACZ,WAAW,CAEb;AAED,wBAAsB,0BAA0B,CAC9C,OAAO,EAAE,OAAO,GACf,OAAO,CAAC,QAAQ,CAAC,CA4GnB"}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
import * as dntShim from "
|
|
1
|
+
import * as dntShim from "../_dnt.shims.js";
|
|
2
2
|
import type { ModelProvider } from "@bolt-foundry/gambit-core/internal/types";
|
|
3
|
+
/**
|
|
4
|
+
* Start the WebSocket simulator server used by the Gambit debug UI.
|
|
5
|
+
*/
|
|
3
6
|
export declare function startWebSocketSimulator(opts: {
|
|
4
7
|
deckPath: string;
|
|
5
8
|
modelProvider: ModelProvider;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/src/server.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,kBAAkB,CAAC;AAiB5C,OAAO,KAAK,EAGV,aAAa,EAEd,MAAM,0CAA0C,CAAC;AA+ZlD;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,IAAI,EAAE;IAC5C,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,aAAa,CAAC;IAC7B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,cAAc,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CACrC,GAAG,UAAU,CAAC,OAAO,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAunExC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as dntShim from "
|
|
2
|
-
import * as path from "
|
|
1
|
+
import * as dntShim from "../_dnt.shims.js";
|
|
2
|
+
import * as path from "../deps/jsr.io/@std/path/1.1.4/mod.js";
|
|
3
3
|
import { isGambitEndSignal, runDeck, } from "@bolt-foundry/gambit-core/internal/runtime";
|
|
4
4
|
import { sanitizeNumber } from "./test_bot.js";
|
|
5
5
|
import { makeConsoleTracer } from "./trace.js";
|
|
@@ -13,7 +13,7 @@ const moduleLocation = (() => {
|
|
|
13
13
|
return path.dirname(path.fromFileUrl(url));
|
|
14
14
|
};
|
|
15
15
|
try {
|
|
16
|
-
const resolved =
|
|
16
|
+
const resolved = globalThis[Symbol.for("import-meta-ponyfill-esmodule")](import.meta).resolve("./server.ts");
|
|
17
17
|
const fromResolved = directoryFromUrl(resolved);
|
|
18
18
|
if (fromResolved)
|
|
19
19
|
return { dir: fromResolved, isLocal: true };
|
|
@@ -21,7 +21,7 @@ const moduleLocation = (() => {
|
|
|
21
21
|
catch {
|
|
22
22
|
// ignore resolution failures and try other strategies
|
|
23
23
|
}
|
|
24
|
-
const fromMeta = directoryFromUrl(import.meta.url);
|
|
24
|
+
const fromMeta = directoryFromUrl(globalThis[Symbol.for("import-meta-ponyfill-esmodule")](import.meta).url);
|
|
25
25
|
if (fromMeta)
|
|
26
26
|
return { dir: fromMeta, isLocal: true };
|
|
27
27
|
return { dir: dntShim.Deno.cwd(), isLocal: false };
|
|
@@ -29,7 +29,7 @@ const moduleLocation = (() => {
|
|
|
29
29
|
const moduleDir = moduleLocation.dir;
|
|
30
30
|
const simulatorBundleUrl = (() => {
|
|
31
31
|
try {
|
|
32
|
-
return
|
|
32
|
+
return globalThis[Symbol.for("import-meta-ponyfill-esmodule")](import.meta).resolve("../simulator-ui/dist/bundle.js");
|
|
33
33
|
}
|
|
34
34
|
catch {
|
|
35
35
|
return undefined;
|
|
@@ -37,7 +37,7 @@ const simulatorBundleUrl = (() => {
|
|
|
37
37
|
})();
|
|
38
38
|
const simulatorBundleSourceMapUrl = (() => {
|
|
39
39
|
try {
|
|
40
|
-
return
|
|
40
|
+
return globalThis[Symbol.for("import-meta-ponyfill-esmodule")](import.meta).resolve("../simulator-ui/dist/bundle.js.map");
|
|
41
41
|
}
|
|
42
42
|
catch {
|
|
43
43
|
return undefined;
|
|
@@ -237,7 +237,7 @@ function cloneValue(value) {
|
|
|
237
237
|
function resolveDeckPath(p) {
|
|
238
238
|
const absolutePath = path.isAbsolute(p) ? p : path.resolve(p);
|
|
239
239
|
try {
|
|
240
|
-
const url =
|
|
240
|
+
const url = globalThis[Symbol.for("import-meta-ponyfill-esmodule")](import.meta).resolve(path.toFileUrl(absolutePath).href);
|
|
241
241
|
if (url.startsWith("file:"))
|
|
242
242
|
return path.fromFileUrl(url);
|
|
243
243
|
return url;
|
|
@@ -306,6 +306,9 @@ function deriveInitialFromSchema(schema) {
|
|
|
306
306
|
return undefined;
|
|
307
307
|
}
|
|
308
308
|
}
|
|
309
|
+
/**
|
|
310
|
+
* Start the WebSocket simulator server used by the Gambit debug UI.
|
|
311
|
+
*/
|
|
309
312
|
export function startWebSocketSimulator(opts) {
|
|
310
313
|
const port = opts.port ?? 8000;
|
|
311
314
|
const consoleTracer = opts.verbose ? makeConsoleTracer() : undefined;
|
|
@@ -1091,6 +1094,16 @@ export function startWebSocketSimulator(opts) {
|
|
|
1091
1094
|
try {
|
|
1092
1095
|
const result = await (async () => {
|
|
1093
1096
|
if (runMode !== "turns") {
|
|
1097
|
+
entry = {
|
|
1098
|
+
id: runId,
|
|
1099
|
+
graderId: grader.id,
|
|
1100
|
+
graderPath: grader.path,
|
|
1101
|
+
graderLabel: grader.label,
|
|
1102
|
+
status: "running",
|
|
1103
|
+
runAt: startedAt,
|
|
1104
|
+
input: { session: sessionPayload },
|
|
1105
|
+
};
|
|
1106
|
+
currentState = upsertCalibrationRun(currentState, entry);
|
|
1094
1107
|
return await runDeckWithFallback({
|
|
1095
1108
|
path: grader.path,
|
|
1096
1109
|
input: { session: sessionPayload },
|
|
@@ -1107,6 +1120,7 @@ export function startWebSocketSimulator(opts) {
|
|
|
1107
1120
|
.filter(({ msg }) => msg.role === "assistant" &&
|
|
1108
1121
|
typeof msg.content === "string" &&
|
|
1109
1122
|
msg.content.trim().length > 0);
|
|
1123
|
+
const totalTurns = assistantTurns.length;
|
|
1110
1124
|
const turns = [];
|
|
1111
1125
|
entry = {
|
|
1112
1126
|
id: runId,
|
|
@@ -1115,11 +1129,11 @@ export function startWebSocketSimulator(opts) {
|
|
|
1115
1129
|
graderLabel: grader.label,
|
|
1116
1130
|
status: "running",
|
|
1117
1131
|
runAt: startedAt,
|
|
1118
|
-
result: { mode: "turns", turns: [] },
|
|
1132
|
+
result: { mode: "turns", totalTurns, turns: [] },
|
|
1119
1133
|
};
|
|
1120
1134
|
currentState = upsertCalibrationRun(currentState, entry);
|
|
1121
|
-
if (
|
|
1122
|
-
return { mode: "turns", turns: [] };
|
|
1135
|
+
if (totalTurns === 0) {
|
|
1136
|
+
return { mode: "turns", totalTurns, turns: [] };
|
|
1123
1137
|
}
|
|
1124
1138
|
for (const { msg, idx } of assistantTurns) {
|
|
1125
1139
|
const input = {
|
|
@@ -1146,11 +1160,11 @@ export function startWebSocketSimulator(opts) {
|
|
|
1146
1160
|
});
|
|
1147
1161
|
entry = {
|
|
1148
1162
|
...entry,
|
|
1149
|
-
result: { mode: "turns", turns: [...turns] },
|
|
1163
|
+
result: { mode: "turns", totalTurns, turns: [...turns] },
|
|
1150
1164
|
};
|
|
1151
1165
|
currentState = upsertCalibrationRun(currentState, entry);
|
|
1152
1166
|
}
|
|
1153
|
-
return { mode: "turns", turns };
|
|
1167
|
+
return { mode: "turns", totalTurns, turns };
|
|
1154
1168
|
})();
|
|
1155
1169
|
entry = {
|
|
1156
1170
|
id: runId,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test_bot.d.ts","sourceRoot":"","sources":["../../src/src/test_bot.ts"],"names":[],"mappings":"AAAA,wBAAgB,cAAc,CAC5B,KAAK,EAAE,OAAO,EACd,QAAQ,EAAE,MAAM,EAChB,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,GACzC,MAAM,CAGR"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trace.d.ts","sourceRoot":"","sources":["../../src/src/trace.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0CAA0C,CAAC;AAI3E,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,CAAC,KAAK,EAAE,UAAU,KAAK,IAAI,CAQ7E;AAED,wBAAgB,iBAAiB,IAAI,CAAC,KAAK,EAAE,UAAU,KAAK,IAAI,CAmI/D"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as dntShim from "
|
|
2
|
-
import * as path from "
|
|
1
|
+
import * as dntShim from "../_dnt.shims.js";
|
|
2
|
+
import * as path from "../deps/jsr.io/@std/path/1.1.4/mod.js";
|
|
3
3
|
const logger = console;
|
|
4
4
|
export function makeJsonlTracer(filePath) {
|
|
5
5
|
const resolved = path.resolve(filePath);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bolt-foundry/gambit",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "Agent harness framework for building, running, and verifying LLM workflows in Markdown and code.",
|
|
5
5
|
"homepage": "https://github.com/bolt-foundry/gambit",
|
|
6
6
|
"repository": {
|
|
@@ -11,16 +11,20 @@
|
|
|
11
11
|
"bugs": {
|
|
12
12
|
"url": "https://github.com/bolt-foundry/gambit/issues"
|
|
13
13
|
},
|
|
14
|
-
"main": "./script/
|
|
15
|
-
"module": "./esm/
|
|
14
|
+
"main": "./script/mod.js",
|
|
15
|
+
"module": "./esm/mod.js",
|
|
16
16
|
"exports": {
|
|
17
17
|
".": {
|
|
18
|
-
"import": "./esm/
|
|
19
|
-
"require": "./script/
|
|
18
|
+
"import": "./esm/mod.js",
|
|
19
|
+
"require": "./script/mod.js"
|
|
20
20
|
}
|
|
21
21
|
},
|
|
22
|
+
"scripts": {},
|
|
23
|
+
"bin": {
|
|
24
|
+
"gambit": "bin/gambit.cjs"
|
|
25
|
+
},
|
|
22
26
|
"dependencies": {
|
|
23
|
-
"@bolt-foundry/gambit-core": "^0.
|
|
27
|
+
"@bolt-foundry/gambit-core": "^0.6.0",
|
|
24
28
|
"openai": "^4.78.1",
|
|
25
29
|
"zod": "^3.23.8",
|
|
26
30
|
"zod-to-json-schema": "^3.23.0",
|
|
@@ -1,5 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Based on [import-meta-ponyfill](https://github.com/gaubee/import-meta-ponyfill),
|
|
3
|
+
* but instead of using npm to install additional dependencies,
|
|
4
|
+
* this approach manually consolidates cjs/mjs/d.ts into a single file.
|
|
5
|
+
*
|
|
6
|
+
* Note that this code might be imported multiple times
|
|
7
|
+
* (for example, both dnt.test.polyfills.ts and dnt.polyfills.ts contain this code;
|
|
8
|
+
* or Node.js might dynamically clear the cache and then force a require).
|
|
9
|
+
* Therefore, it's important to avoid redundant writes to global objects.
|
|
10
|
+
* Additionally, consider that commonjs is used alongside esm,
|
|
11
|
+
* so the two ponyfill functions are stored independently in two separate global objects.
|
|
12
|
+
*/
|
|
13
|
+
import { createRequire } from "node:module";
|
|
14
|
+
import { type URL } from "node:url";
|
|
1
15
|
declare global {
|
|
2
16
|
interface ImportMeta {
|
|
17
|
+
/** A string representation of the fully qualified module URL. When the
|
|
18
|
+
* module is loaded locally, the value will be a file URL (e.g.
|
|
19
|
+
* `file:///path/module.ts`).
|
|
20
|
+
*
|
|
21
|
+
* You can also parse the string as a URL to determine more information about
|
|
22
|
+
* how the current module was loaded. For example to determine if a module was
|
|
23
|
+
* local or not:
|
|
24
|
+
*
|
|
25
|
+
* ```ts
|
|
26
|
+
* const url = new URL(import.meta.url);
|
|
27
|
+
* if (url.protocol === "file:") {
|
|
28
|
+
* console.log("this module was loaded locally");
|
|
29
|
+
* }
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
url: string;
|
|
33
|
+
/**
|
|
34
|
+
* A function that returns resolved specifier as if it would be imported
|
|
35
|
+
* using `import(specifier)`.
|
|
36
|
+
*
|
|
37
|
+
* ```ts
|
|
38
|
+
* console.log(import.meta.resolve("./foo.js"));
|
|
39
|
+
* // file:///dev/foo.js
|
|
40
|
+
* ```
|
|
41
|
+
*
|
|
42
|
+
* @param specifier The module specifier to resolve relative to `parent`.
|
|
43
|
+
* @param parent The absolute parent module URL to resolve from.
|
|
44
|
+
* @returns The absolute (`file:`) URL string for the resolved module.
|
|
45
|
+
*/
|
|
46
|
+
resolve(specifier: string, parent?: string | URL | undefined): string;
|
|
3
47
|
/** A flag that indicates if the current module is the main module that was
|
|
4
48
|
* called when starting the program under Deno.
|
|
5
49
|
*
|
|
@@ -10,16 +54,48 @@ declare global {
|
|
|
10
54
|
* ```
|
|
11
55
|
*/
|
|
12
56
|
main: boolean;
|
|
13
|
-
/**
|
|
14
|
-
* using `import(specifier)`.
|
|
57
|
+
/** The absolute path of the current module.
|
|
15
58
|
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
59
|
+
* This property is only provided for local modules (ie. using `file://` URLs).
|
|
60
|
+
*
|
|
61
|
+
* Example:
|
|
62
|
+
* ```
|
|
63
|
+
* // Unix
|
|
64
|
+
* console.log(import.meta.filename); // /home/alice/my_module.ts
|
|
65
|
+
*
|
|
66
|
+
* // Windows
|
|
67
|
+
* console.log(import.meta.filename); // C:\alice\my_module.ts
|
|
19
68
|
* ```
|
|
20
69
|
*/
|
|
21
|
-
|
|
70
|
+
filename: string;
|
|
71
|
+
/** The absolute path of the directory containing the current module.
|
|
72
|
+
*
|
|
73
|
+
* This property is only provided for local modules (ie. using `file://` URLs).
|
|
74
|
+
*
|
|
75
|
+
* * Example:
|
|
76
|
+
* ```
|
|
77
|
+
* // Unix
|
|
78
|
+
* console.log(import.meta.dirname); // /home/alice
|
|
79
|
+
*
|
|
80
|
+
* // Windows
|
|
81
|
+
* console.log(import.meta.dirname); // C:\alice
|
|
82
|
+
* ```
|
|
83
|
+
*/
|
|
84
|
+
dirname: string;
|
|
22
85
|
}
|
|
23
86
|
}
|
|
87
|
+
type NodeRequest = ReturnType<typeof createRequire>;
|
|
88
|
+
type NodeModule = NonNullable<NodeRequest["main"]>;
|
|
89
|
+
interface ImportMetaPonyfillCommonjs {
|
|
90
|
+
(require: NodeRequest, module: NodeModule): ImportMeta;
|
|
91
|
+
}
|
|
92
|
+
interface ImportMetaPonyfillEsmodule {
|
|
93
|
+
(importMeta: ImportMeta): ImportMeta;
|
|
94
|
+
}
|
|
95
|
+
interface ImportMetaPonyfill extends ImportMetaPonyfillCommonjs, ImportMetaPonyfillEsmodule {
|
|
96
|
+
}
|
|
97
|
+
export declare let import_meta_ponyfill_commonjs: ImportMetaPonyfillCommonjs;
|
|
98
|
+
export declare let import_meta_ponyfill_esmodule: ImportMetaPonyfillEsmodule;
|
|
99
|
+
export declare let import_meta_ponyfill: ImportMetaPonyfill;
|
|
24
100
|
export {};
|
|
25
101
|
//# sourceMappingURL=_dnt.polyfills.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"_dnt.polyfills.d.ts","sourceRoot":"","sources":["../src/_dnt.polyfills.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,UAAU;QAClB
|
|
1
|
+
{"version":3,"file":"_dnt.polyfills.d.ts","sourceRoot":"","sources":["../src/_dnt.polyfills.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5C,OAAO,EAAgC,KAAK,GAAG,EAAE,MAAM,UAAU,CAAC;AAGlE,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,UAAU;QAClB;;;;;;;;;;;;;;WAcG;QACH,GAAG,EAAE,MAAM,CAAC;QACZ;;;;;;;;;;;;WAYG;QACH,OAAO,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,GAAG,GAAG,SAAS,GAAG,MAAM,CAAC;QACtE;;;;;;;;WAQG;QACH,IAAI,EAAE,OAAO,CAAC;QAEd;;;;;;;;;;;;WAYG;QACH,QAAQ,EAAE,MAAM,CAAC;QAEjB;;;;;;;;;;;;WAYG;QACH,OAAO,EAAE,MAAM,CAAC;KACjB;CACF;AAED,KAAK,WAAW,GAAG,UAAU,CAAC,OAAO,aAAa,CAAC,CAAC;AACpD,KAAK,UAAU,GAAG,WAAW,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC;AACnD,UAAU,0BAA0B;IAClC,CAAC,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,UAAU,GAAG,UAAU,CAAC;CACxD;AACD,UAAU,0BAA0B;IAClC,CAAC,UAAU,EAAE,UAAU,GAAG,UAAU,CAAC;CACtC;AACD,UAAU,kBACR,SAAQ,0BAA0B,EAAE,0BAA0B;CAC/D;AAiBD,eAAO,IAAI,6BAA6B,EA2BnC,0BAA0B,CAAC;AAMhC,eAAO,IAAI,6BAA6B,EA4DnC,0BAA0B,CAAC;AAMhC,eAAO,IAAI,oBAAoB,EAoB1B,kBAAkB,CAAC"}
|
package/script/_dnt.polyfills.js
CHANGED
|
@@ -1,2 +1,130 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.import_meta_ponyfill = exports.import_meta_ponyfill_esmodule = exports.import_meta_ponyfill_commonjs = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Based on [import-meta-ponyfill](https://github.com/gaubee/import-meta-ponyfill),
|
|
6
|
+
* but instead of using npm to install additional dependencies,
|
|
7
|
+
* this approach manually consolidates cjs/mjs/d.ts into a single file.
|
|
8
|
+
*
|
|
9
|
+
* Note that this code might be imported multiple times
|
|
10
|
+
* (for example, both dnt.test.polyfills.ts and dnt.polyfills.ts contain this code;
|
|
11
|
+
* or Node.js might dynamically clear the cache and then force a require).
|
|
12
|
+
* Therefore, it's important to avoid redundant writes to global objects.
|
|
13
|
+
* Additionally, consider that commonjs is used alongside esm,
|
|
14
|
+
* so the two ponyfill functions are stored independently in two separate global objects.
|
|
15
|
+
*/
|
|
16
|
+
//@ts-ignore
|
|
17
|
+
const node_module_1 = require("node:module");
|
|
18
|
+
//@ts-ignore
|
|
19
|
+
const node_url_1 = require("node:url");
|
|
20
|
+
//@ts-ignore
|
|
21
|
+
const node_path_1 = require("node:path");
|
|
22
|
+
const defineGlobalPonyfill = (symbolFor, fn) => {
|
|
23
|
+
if (!Reflect.has(globalThis, Symbol.for(symbolFor))) {
|
|
24
|
+
Object.defineProperty(globalThis, Symbol.for(symbolFor), {
|
|
25
|
+
configurable: true,
|
|
26
|
+
get() {
|
|
27
|
+
return fn;
|
|
28
|
+
},
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
exports.import_meta_ponyfill_commonjs = (Reflect.get(globalThis, Symbol.for("import-meta-ponyfill-commonjs")) ??
|
|
33
|
+
(() => {
|
|
34
|
+
const moduleImportMetaWM = new WeakMap();
|
|
35
|
+
return (require, module) => {
|
|
36
|
+
let importMetaCache = moduleImportMetaWM.get(module);
|
|
37
|
+
if (importMetaCache == null) {
|
|
38
|
+
const importMeta = Object.assign(Object.create(null), {
|
|
39
|
+
url: (0, node_url_1.pathToFileURL)(module.filename).href,
|
|
40
|
+
main: require.main == module,
|
|
41
|
+
resolve: (specifier, parentURL = importMeta.url) => {
|
|
42
|
+
return (0, node_url_1.pathToFileURL)((importMeta.url === parentURL
|
|
43
|
+
? require
|
|
44
|
+
: (0, node_module_1.createRequire)(parentURL))
|
|
45
|
+
.resolve(specifier)).href;
|
|
46
|
+
},
|
|
47
|
+
filename: module.filename,
|
|
48
|
+
dirname: module.path,
|
|
49
|
+
});
|
|
50
|
+
moduleImportMetaWM.set(module, importMeta);
|
|
51
|
+
importMetaCache = importMeta;
|
|
52
|
+
}
|
|
53
|
+
return importMetaCache;
|
|
54
|
+
};
|
|
55
|
+
})());
|
|
56
|
+
defineGlobalPonyfill("import-meta-ponyfill-commonjs", exports.import_meta_ponyfill_commonjs);
|
|
57
|
+
exports.import_meta_ponyfill_esmodule = (Reflect.get(globalThis, Symbol.for("import-meta-ponyfill-esmodule")) ??
|
|
58
|
+
((importMeta) => {
|
|
59
|
+
const resolveFunStr = String(importMeta.resolve);
|
|
60
|
+
const shimWs = new WeakSet();
|
|
61
|
+
//@ts-ignore
|
|
62
|
+
const mainUrl = ("file:///" + process.argv[1].replace(/\\/g, "/"))
|
|
63
|
+
.replace(/\/{3,}/, "///");
|
|
64
|
+
const commonShim = (importMeta) => {
|
|
65
|
+
if (typeof importMeta.main !== "boolean") {
|
|
66
|
+
importMeta.main = importMeta.url === mainUrl;
|
|
67
|
+
}
|
|
68
|
+
if (typeof importMeta.filename !== "string") {
|
|
69
|
+
importMeta.filename = (0, node_url_1.fileURLToPath)(importMeta.url);
|
|
70
|
+
importMeta.dirname = (0, node_path_1.dirname)(importMeta.filename);
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
if (
|
|
74
|
+
// v16.2.0+, v14.18.0+: Add support for WHATWG URL object to parentURL parameter.
|
|
75
|
+
resolveFunStr === "undefined" ||
|
|
76
|
+
// v20.0.0+, v18.19.0+"" This API now returns a string synchronously instead of a Promise.
|
|
77
|
+
resolveFunStr.startsWith("async")
|
|
78
|
+
// enable by --experimental-import-meta-resolve flag
|
|
79
|
+
) {
|
|
80
|
+
exports.import_meta_ponyfill_esmodule = (importMeta) => {
|
|
81
|
+
if (!shimWs.has(importMeta)) {
|
|
82
|
+
shimWs.add(importMeta);
|
|
83
|
+
const importMetaUrlRequire = {
|
|
84
|
+
url: importMeta.url,
|
|
85
|
+
require: (0, node_module_1.createRequire)(importMeta.url),
|
|
86
|
+
};
|
|
87
|
+
importMeta.resolve = function resolve(specifier, parentURL = importMeta.url) {
|
|
88
|
+
return (0, node_url_1.pathToFileURL)((importMetaUrlRequire.url === parentURL
|
|
89
|
+
? importMetaUrlRequire.require
|
|
90
|
+
: (0, node_module_1.createRequire)(parentURL)).resolve(specifier)).href;
|
|
91
|
+
};
|
|
92
|
+
commonShim(importMeta);
|
|
93
|
+
}
|
|
94
|
+
return importMeta;
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
else {
|
|
98
|
+
/// native support
|
|
99
|
+
exports.import_meta_ponyfill_esmodule = (importMeta) => {
|
|
100
|
+
if (!shimWs.has(importMeta)) {
|
|
101
|
+
shimWs.add(importMeta);
|
|
102
|
+
commonShim(importMeta);
|
|
103
|
+
}
|
|
104
|
+
return importMeta;
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
return (0, exports.import_meta_ponyfill_esmodule)(importMeta);
|
|
108
|
+
}));
|
|
109
|
+
defineGlobalPonyfill("import-meta-ponyfill-esmodule", exports.import_meta_ponyfill_esmodule);
|
|
110
|
+
exports.import_meta_ponyfill = ((...args) => {
|
|
111
|
+
const _MODULE = (() => {
|
|
112
|
+
if (typeof require === "function" && typeof module === "object") {
|
|
113
|
+
return "commonjs";
|
|
114
|
+
}
|
|
115
|
+
else {
|
|
116
|
+
// eval("typeof import.meta");
|
|
117
|
+
return "esmodule";
|
|
118
|
+
}
|
|
119
|
+
})();
|
|
120
|
+
if (_MODULE === "commonjs") {
|
|
121
|
+
//@ts-ignore
|
|
122
|
+
exports.import_meta_ponyfill = (r, m) => (0, exports.import_meta_ponyfill_commonjs)(r, m);
|
|
123
|
+
}
|
|
124
|
+
else {
|
|
125
|
+
//@ts-ignore
|
|
126
|
+
exports.import_meta_ponyfill = (im) => (0, exports.import_meta_ponyfill_esmodule)(im);
|
|
127
|
+
}
|
|
128
|
+
//@ts-ignore
|
|
129
|
+
return (0, exports.import_meta_ponyfill)(...args);
|
|
130
|
+
});
|
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
36
|
exports.checkWindows = checkWindows;
|
|
27
37
|
// Copyright 2018-2025 the Deno authors. MIT license.
|
|
@@ -7,7 +7,7 @@ export declare const DELIMITER: ";" | ":";
|
|
|
7
7
|
* The character used to separate components of a file path.
|
|
8
8
|
* On Windows, this is `\`. On all other platforms, this is `/`.
|
|
9
9
|
*/
|
|
10
|
-
export declare const SEPARATOR: "
|
|
10
|
+
export declare const SEPARATOR: "/" | "\\";
|
|
11
11
|
/**
|
|
12
12
|
* A regular expression that matches one or more path separators.
|
|
13
13
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../../../../src/deps/jsr.io/@std/path/1.1.4/posix/constants.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,eAAO,MAAM,SAAS,
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../../../../src/deps/jsr.io/@std/path/1.1.4/posix/constants.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,eAAO,MAAM,SAAS,EAAG,GAAY,CAAC;AACtC;;GAEG;AACH,eAAO,MAAM,SAAS,EAAG,GAAY,CAAC;AACtC;;GAEG;AACH,eAAO,MAAM,iBAAiB,QAAQ,CAAC"}
|
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
36
|
exports.resolve = resolve;
|
|
27
37
|
// Copyright 2018-2025 the Deno authors. MIT license.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../../../../src/deps/jsr.io/@std/path/1.1.4/windows/constants.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,eAAO,MAAM,SAAS,
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../../../../src/deps/jsr.io/@std/path/1.1.4/windows/constants.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,eAAO,MAAM,SAAS,EAAG,GAAY,CAAC;AACtC;;GAEG;AACH,eAAO,MAAM,SAAS,EAAG,IAAa,CAAC;AACvC;;GAEG;AACH,eAAO,MAAM,iBAAiB,QAAW,CAAC"}
|