@agentage/extension 0.8.0 → 0.10.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 (60) hide show
  1. package/dist/agcid/agcid.d.ts +1 -3
  2. package/dist/agcid/agcid.js +2 -3
  3. package/dist/agcid/header.d.ts +3 -0
  4. package/dist/agcid/header.js +3 -0
  5. package/dist/api/openapi-doc.d.ts +1 -0
  6. package/dist/api/openapi-doc.js +15 -10
  7. package/dist/api/routes.d.ts +15 -6
  8. package/dist/api/routes.js +2 -5
  9. package/dist/auth/part-auth.d.ts +3 -0
  10. package/dist/auth/part-auth.js +12 -1
  11. package/dist/auth/route-access.d.ts +1 -0
  12. package/dist/auth/route-access.js +1 -1
  13. package/dist/auth/token-check.d.ts +5 -2
  14. package/dist/auth/token-check.js +10 -3
  15. package/dist/auth/verify-token.js +2 -2
  16. package/dist/command/cli-context.js +4 -1
  17. package/dist/command/command.types.d.ts +2 -0
  18. package/dist/command/command.types.js +1 -0
  19. package/dist/context/context.d.ts +10 -0
  20. package/dist/context/context.js +14 -1
  21. package/dist/context/recording-log.js +3 -3
  22. package/dist/context/test-command-context.d.ts +2 -0
  23. package/dist/context/test-command-context.js +13 -4
  24. package/dist/context/test-context.d.ts +4 -1
  25. package/dist/context/test-context.js +6 -1
  26. package/dist/contracts/index.d.ts +6 -0
  27. package/dist/contracts/index.js +6 -0
  28. package/dist/envelope/envelope.d.ts +8 -5
  29. package/dist/envelope/envelope.js +15 -3
  30. package/dist/envelope/envelope.schema.d.ts +3 -5
  31. package/dist/envelope/envelope.schema.js +8 -4
  32. package/dist/index.d.ts +9 -12
  33. package/dist/index.js +8 -10
  34. package/dist/log/log.d.ts +3 -0
  35. package/dist/log/log.js +7 -3
  36. package/dist/log/span.d.ts +9 -0
  37. package/dist/log/span.js +19 -0
  38. package/dist/mcp/tools.js +5 -4
  39. package/dist/pages/inline-hashes.d.ts +3 -0
  40. package/dist/pages/inline-hashes.js +27 -0
  41. package/dist/pages/pages-app.js +22 -11
  42. package/dist/pages/pages.d.ts +5 -1
  43. package/dist/pages/site-from-dir.d.ts +7 -0
  44. package/dist/pages/site-from-dir.js +31 -0
  45. package/dist/pages/types.d.ts +3 -0
  46. package/dist/pages/types.js +40 -0
  47. package/dist/runtime/build-info.d.ts +1 -0
  48. package/dist/runtime/build-info.js +2 -1
  49. package/dist/runtime/part-runners.js +9 -2
  50. package/dist/runtime/run-part.js +2 -1
  51. package/dist/server/api-routes.js +16 -3
  52. package/dist/server/app.d.ts +4 -0
  53. package/dist/server/app.js +13 -2
  54. package/dist/testing/test-server.js +1 -1
  55. package/dist/tool/build-info.js +4 -4
  56. package/dist/tool/index.d.ts +4 -1
  57. package/dist/tool/index.js +4 -1
  58. package/dist/worker/run-log.js +7 -3
  59. package/package.json +5 -1
  60. package/schemas/error-envelope.schema.json +27 -27
@@ -1,8 +1,8 @@
1
1
  import {} from '../discovery/discovery.js';
2
2
  import { FULL_SHA } from '../manifest/primitives.schema.js';
3
- import { isoSeconds } from '../runtime/build-info.js';
3
+ import { buildTimeOf } from '../runtime/build-info.js';
4
4
  import { mustRun } from './exec.js';
5
- const commitOf = async (dir, env, run) => {
5
+ const headCommit = async (dir, env, run) => {
6
6
  const given = env['COMMIT_SHA'] || env['GITHUB_SHA'];
7
7
  if (given)
8
8
  return given;
@@ -10,8 +10,8 @@ const commitOf = async (dir, env, run) => {
10
10
  };
11
11
  // The commit every image label, /health and the record carry: CI's sha, else the checkout's HEAD.
12
12
  export const resolveBuildInfo = async (dir, env, run, now = new Date()) => {
13
- const commit = await commitOf(dir, env, run);
13
+ const commit = await headCommit(dir, env, run);
14
14
  if (!FULL_SHA.test(commit))
15
15
  throw new Error(`commit is not a full 40-hex sha: ${commit}`);
16
- return { commit, buildTime: env['BUILD_TIME'] || isoSeconds(now) };
16
+ return { commit, buildTime: buildTimeOf(env, now) };
17
17
  };
@@ -1,7 +1,10 @@
1
1
  export { checkCli } from '../command/check-cli.js';
2
2
  export { runCommand, type RunCommandOptions } from '../command/run-command.js';
3
- export { type ExtensionPackage, type CommandSpec } from '../manifest/manifest.schema.js';
3
+ export { PackageSchema, type CommandSpec, type ExtensionPackage, } from '../manifest/manifest.schema.js';
4
+ export { imageParts } from '../manifest/parts.js';
5
+ export { SERVED_KINDS, STORE_KINDS, type StoreKind } from '../manifest/primitives.schema.js';
4
6
  export { readManifest, validateManifest } from '../manifest/read-manifest.js';
7
+ export { canonical, mcpSnapshot, PROTOCOL_VERSIONS, type McpSnapshot, type ProtocolVersion, } from '../mcp/snapshot.js';
5
8
  export { build, type BuildDeps, type BuildOptions, type BuildResult, type BuiltImage, } from './build.js';
6
9
  export { check, type CheckProblem, type CheckReport } from './check.js';
7
10
  export { writeContracts } from './contracts.js';
@@ -1,7 +1,10 @@
1
1
  export { checkCli } from '../command/check-cli.js';
2
2
  export { runCommand } from '../command/run-command.js';
3
- export {} from '../manifest/manifest.schema.js';
3
+ export { PackageSchema, } from '../manifest/manifest.schema.js';
4
+ export { imageParts } from '../manifest/parts.js';
5
+ export { SERVED_KINDS, STORE_KINDS } from '../manifest/primitives.schema.js';
4
6
  export { readManifest, validateManifest } from '../manifest/read-manifest.js';
7
+ export { canonical, mcpSnapshot, PROTOCOL_VERSIONS, } from '../mcp/snapshot.js';
5
8
  export { build, } from './build.js';
6
9
  export { check } from './check.js';
7
10
  export { writeContracts } from './contracts.js';
@@ -1,5 +1,5 @@
1
1
  import { AsyncLocalStorage } from 'node:async_hooks';
2
- import { messageOf } from '../log/log.js';
2
+ import { logAt, messageOf, withLineAt, } from '../log/log.js';
3
3
  export const LOG_CAP_BYTES = 64 * 1024;
4
4
  const TRUNCATED = '\n[log truncated at 64 KB]\n';
5
5
  const current = new AsyncLocalStorage();
@@ -22,7 +22,11 @@ const record = (level, message) => {
22
22
  append(buffer, `${level} ${message}`);
23
23
  };
24
24
  // ctx.log for a worker: the usual JSON line, and inside a run also the run's own log.
25
- export const runLog = (base) => ({
25
+ const runLogAt = (base) => (level, message, fields) => {
26
+ record(level, message);
27
+ logAt(base, level, message, fields);
28
+ };
29
+ export const runLog = (base) => withLineAt({
26
30
  info: (message, fields) => {
27
31
  record('info', message);
28
32
  base.info(message, fields);
@@ -35,4 +39,4 @@ export const runLog = (base) => ({
35
39
  record('error', messageOf(error));
36
40
  base.error(error, fields);
37
41
  },
38
- });
42
+ }, runLogAt(base));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentage/extension",
3
- "version": "0.8.0",
3
+ "version": "0.10.0",
4
4
  "description": "The agentage extension kit: create(ctx) per part (pages, ui, api, mcp, worker, cli), the store, /health, discovery, the envelope, and the build tool with up and token",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -28,6 +28,10 @@
28
28
  "types": "./dist/tool/index.d.ts",
29
29
  "default": "./dist/tool/index.js"
30
30
  },
31
+ "./contracts": {
32
+ "types": "./dist/contracts/index.d.ts",
33
+ "default": "./dist/contracts/index.js"
34
+ },
31
35
  "./migrate": {
32
36
  "default": "./dist/store/migrate.js"
33
37
  },
@@ -13,18 +13,7 @@
13
13
  "properties": {
14
14
  "code": {
15
15
  "type": "string",
16
- "enum": [
17
- "VALIDATION_ERROR",
18
- "UNAUTHORIZED",
19
- "FORBIDDEN",
20
- "NOT_FOUND",
21
- "CONFLICT",
22
- "PRECONDITION_FAILED",
23
- "PAYLOAD_TOO_LARGE",
24
- "RATE_LIMITED",
25
- "INTERNAL",
26
- "UNAVAILABLE"
27
- ]
16
+ "pattern": "^[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$"
28
17
  },
29
18
  "message": {
30
19
  "type": "string",
@@ -35,23 +24,34 @@
35
24
  "pattern": "^[A-Za-z0-9._:-]{8,128}$"
36
25
  },
37
26
  "details": {
38
- "type": "array",
39
- "items": {
40
- "type": "object",
41
- "properties": {
42
- "field": {
43
- "type": "string"
44
- },
45
- "message": {
46
- "type": "string"
27
+ "anyOf": [
28
+ {
29
+ "type": "array",
30
+ "items": {
31
+ "type": "object",
32
+ "properties": {
33
+ "field": {
34
+ "type": "string"
35
+ },
36
+ "message": {
37
+ "type": "string"
38
+ }
39
+ },
40
+ "required": [
41
+ "field",
42
+ "message"
43
+ ],
44
+ "additionalProperties": false
47
45
  }
48
46
  },
49
- "required": [
50
- "field",
51
- "message"
52
- ],
53
- "additionalProperties": false
54
- }
47
+ {
48
+ "type": "object",
49
+ "propertyNames": {
50
+ "type": "string"
51
+ },
52
+ "additionalProperties": {}
53
+ }
54
+ ]
55
55
  }
56
56
  },
57
57
  "required": [