antpath 0.2.1 → 0.3.1

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 (105) hide show
  1. package/README.md +55 -40
  2. package/dist/_shared/cleanup-policy.d.ts +8 -0
  3. package/dist/_shared/cleanup-policy.js +24 -0
  4. package/dist/_shared/config.d.ts +47 -0
  5. package/dist/_shared/config.js +150 -0
  6. package/dist/_shared/dev-stack.d.ts +19 -0
  7. package/dist/_shared/dev-stack.js +105 -0
  8. package/dist/_shared/errors.d.ts +8 -0
  9. package/dist/_shared/errors.js +18 -0
  10. package/dist/_shared/http.d.ts +20 -0
  11. package/dist/_shared/http.js +94 -0
  12. package/dist/_shared/index.d.ts +17 -0
  13. package/dist/_shared/index.js +20 -0
  14. package/dist/{providers → _shared}/known-events.d.ts +10 -10
  15. package/dist/{providers → _shared}/known-events.js +9 -9
  16. package/dist/_shared/operations.d.ts +19 -0
  17. package/dist/_shared/operations.js +42 -0
  18. package/dist/_shared/proxy-protocol.d.ts +148 -0
  19. package/dist/_shared/proxy-protocol.js +113 -0
  20. package/dist/_shared/proxy-validation.d.ts +19 -0
  21. package/dist/_shared/proxy-validation.js +51 -0
  22. package/dist/_shared/runtime-types.d.ts +90 -0
  23. package/dist/_shared/runtime-types.js +2 -0
  24. package/dist/{errors.d.ts → _shared/sdk-errors.d.ts} +10 -1
  25. package/dist/{errors.js → _shared/sdk-errors.js} +15 -2
  26. package/dist/{utils/secrets.js → _shared/sdk-secrets.js} +1 -1
  27. package/dist/_shared/secrets.d.ts +7 -0
  28. package/dist/_shared/secrets.js +20 -0
  29. package/dist/_shared/status.d.ts +8 -0
  30. package/dist/_shared/status.js +46 -0
  31. package/dist/_shared/submission.d.ts +142 -0
  32. package/dist/_shared/submission.js +681 -0
  33. package/dist/{template → _shared/template}/compiler.js +3 -3
  34. package/dist/{template/index.d.ts → _shared/template/helpers.d.ts} +0 -2
  35. package/dist/{template/index.js → _shared/template/helpers.js} +1 -2
  36. package/dist/_shared/template/index.d.ts +4 -0
  37. package/dist/_shared/template/index.js +4 -0
  38. package/dist/_shared/template/mapper.d.ts +11 -0
  39. package/dist/_shared/template/mapper.js +70 -0
  40. package/dist/cli.mjs +1234 -64
  41. package/dist/cli.mjs.sha256 +1 -1
  42. package/dist/client.d.ts +93 -8
  43. package/dist/client.js +192 -30
  44. package/dist/client.js.map +1 -1
  45. package/dist/index.d.ts +16 -10
  46. package/dist/index.js +16 -7
  47. package/dist/index.js.map +1 -1
  48. package/docs/cleanup.md +7 -4
  49. package/docs/credentials.md +12 -12
  50. package/docs/events.md +19 -82
  51. package/docs/outputs.md +15 -4
  52. package/docs/quickstart.md +42 -5
  53. package/docs/skills.md +1 -1
  54. package/docs/templates.md +1 -1
  55. package/docs/testing.md +11 -8
  56. package/examples/mcp-static-bearer.ts +14 -9
  57. package/examples/quickstart.ts +8 -6
  58. package/package.json +4 -5
  59. package/references/implementation-plan.md +1 -1
  60. package/dist/credentials.d.ts +0 -3
  61. package/dist/credentials.js +0 -56
  62. package/dist/credentials.js.map +0 -1
  63. package/dist/errors.js.map +0 -1
  64. package/dist/files/downloader.d.ts +0 -3
  65. package/dist/files/downloader.js +0 -43
  66. package/dist/files/downloader.js.map +0 -1
  67. package/dist/platform/client.d.ts +0 -204
  68. package/dist/platform/client.js +0 -203
  69. package/dist/platform/client.js.map +0 -1
  70. package/dist/platform/index.d.ts +0 -1
  71. package/dist/platform/index.js +0 -2
  72. package/dist/platform/index.js.map +0 -1
  73. package/dist/providers/anthropic/provider.d.ts +0 -36
  74. package/dist/providers/anthropic/provider.js +0 -380
  75. package/dist/providers/anthropic/provider.js.map +0 -1
  76. package/dist/providers/known-events.js.map +0 -1
  77. package/dist/providers/types.d.ts +0 -42
  78. package/dist/providers/types.js.map +0 -1
  79. package/dist/run/controller.d.ts +0 -30
  80. package/dist/run/controller.js +0 -314
  81. package/dist/run/controller.js.map +0 -1
  82. package/dist/skills/packager.d.ts +0 -11
  83. package/dist/skills/packager.js +0 -76
  84. package/dist/skills/packager.js.map +0 -1
  85. package/dist/template/compiler.js.map +0 -1
  86. package/dist/template/index.js.map +0 -1
  87. package/dist/template/types.js +0 -2
  88. package/dist/template/types.js.map +0 -1
  89. package/dist/types.d.ts +0 -149
  90. package/dist/types.js +0 -2
  91. package/dist/types.js.map +0 -1
  92. package/dist/utils/events.d.ts +0 -27
  93. package/dist/utils/events.js +0 -120
  94. package/dist/utils/events.js.map +0 -1
  95. package/dist/utils/paths.d.ts +0 -3
  96. package/dist/utils/paths.js +0 -27
  97. package/dist/utils/paths.js.map +0 -1
  98. package/dist/utils/secrets.js.map +0 -1
  99. package/dist/utils/stable.js.map +0 -1
  100. /package/dist/{utils/secrets.d.ts → _shared/sdk-secrets.d.ts} +0 -0
  101. /package/dist/{utils → _shared}/stable.d.ts +0 -0
  102. /package/dist/{utils → _shared}/stable.js +0 -0
  103. /package/dist/{template → _shared/template}/compiler.d.ts +0 -0
  104. /package/dist/{template → _shared/template}/types.d.ts +0 -0
  105. /package/dist/{providers → _shared/template}/types.js +0 -0
@@ -1,4 +1,3 @@
1
- export { compileTemplate } from "./compiler.js";
2
1
  export function defineTemplate(definition) {
3
2
  return Object.freeze(definition);
4
3
  }
@@ -11,4 +10,4 @@ export function requiredStaticBearer() {
11
10
  export function requiredOAuthAccessToken() {
12
11
  return { type: "oauth_access_token", required: true };
13
12
  }
14
- //# sourceMappingURL=index.js.map
13
+ //# sourceMappingURL=helpers.js.map
@@ -0,0 +1,4 @@
1
+ export type { CredentialRequirement, EnvironmentDefinition, McpServerDefinition, OutputDefinition, SkillDefinition, TemplateDefinition, TemplateVariableDefinition } from "./types.js";
2
+ export { compileTemplate, type ResolvedMcpServer, type ResolvedTemplate } from "./compiler.js";
3
+ export { defineTemplate, string, requiredStaticBearer, requiredOAuthAccessToken } from "./helpers.js";
4
+ export { toPlatformSubmissionTemplate } from "./mapper.js";
@@ -0,0 +1,4 @@
1
+ export { compileTemplate } from "./compiler.js";
2
+ export { defineTemplate, string, requiredStaticBearer, requiredOAuthAccessToken } from "./helpers.js";
3
+ export { toPlatformSubmissionTemplate } from "./mapper.js";
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,11 @@
1
+ import type { PlatformTemplateSubmission } from "../submission.js";
2
+ import type { ResolvedTemplate } from "./compiler.js";
3
+ /**
4
+ * Convert a SDK-compiled ResolvedTemplate into the strict
5
+ * PlatformTemplateSubmission shape the BFF parser requires.
6
+ *
7
+ * The mapper is the SINGLE source of truth for the SDK<->BFF template
8
+ * shape contract. Both the AntpathClient class and the CLI's `run`
9
+ * subcommand call this so they cannot drift.
10
+ */
11
+ export declare function toPlatformSubmissionTemplate(resolved: ResolvedTemplate): PlatformTemplateSubmission;
@@ -0,0 +1,70 @@
1
+ /**
2
+ * Convert a SDK-compiled ResolvedTemplate into the strict
3
+ * PlatformTemplateSubmission shape the BFF parser requires.
4
+ *
5
+ * The mapper is the SINGLE source of truth for the SDK<->BFF template
6
+ * shape contract. Both the AntpathClient class and the CLI's `run`
7
+ * subcommand call this so they cannot drift.
8
+ */
9
+ export function toPlatformSubmissionTemplate(resolved) {
10
+ const modelId = typeof resolved.model === "string" ? resolved.model : resolved.model.id;
11
+ const environment = mapEnvironment(resolved.environment);
12
+ const metadata = filterMetadata(resolved.metadata);
13
+ const submission = {
14
+ name: resolved.name,
15
+ model: modelId,
16
+ templateHash: resolved.hash,
17
+ messages: resolved.messages
18
+ };
19
+ return {
20
+ ...submission,
21
+ ...(resolved.system ? { system: resolved.system } : {}),
22
+ ...(metadata ? { metadata } : {}),
23
+ ...(environment ? { environment } : {})
24
+ };
25
+ }
26
+ function mapEnvironment(env) {
27
+ if (!env)
28
+ return undefined;
29
+ let networking;
30
+ if (env.network) {
31
+ if (env.network === "restricted") {
32
+ networking = { mode: "limited", allowedHosts: [] };
33
+ }
34
+ else if (env.network === "unrestricted") {
35
+ networking = { mode: "open" };
36
+ }
37
+ else if (typeof env.network === "object" && env.network.type === "limited") {
38
+ const allowedHosts = env.network.allowedHosts ?? [];
39
+ networking = { mode: "limited", allowedHosts };
40
+ }
41
+ }
42
+ let packages;
43
+ if (env.packages) {
44
+ const collected = [];
45
+ for (const [manager, list] of Object.entries(env.packages)) {
46
+ if (!list)
47
+ continue;
48
+ for (const item of list) {
49
+ collected.push({ name: `${manager}:${item}` });
50
+ }
51
+ }
52
+ if (collected.length > 0)
53
+ packages = collected;
54
+ }
55
+ if (!networking && !packages)
56
+ return undefined;
57
+ return {
58
+ ...(networking ? { networking } : {}),
59
+ ...(packages ? { packages } : {})
60
+ };
61
+ }
62
+ function filterMetadata(metadata) {
63
+ if (!metadata)
64
+ return undefined;
65
+ const entries = Object.entries(metadata);
66
+ if (entries.length === 0)
67
+ return undefined;
68
+ return Object.fromEntries(entries);
69
+ }
70
+ //# sourceMappingURL=mapper.js.map