@pikku/inspector 0.12.59 → 0.12.60

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 (97) hide show
  1. package/CHANGELOG.md +72 -0
  2. package/dist/add/add-agent-scorer.d.ts +2 -0
  3. package/dist/add/add-agent-scorer.js +61 -0
  4. package/dist/add/add-agent.d.ts +4 -0
  5. package/dist/add/add-agent.js +442 -0
  6. package/dist/add/add-channel.d.ts +1 -1
  7. package/dist/add/add-functions.js +1 -1
  8. package/dist/add/add-keyed-wiring.js +1 -1
  9. package/dist/add/add-middleware.js +5 -5
  10. package/dist/add/add-personas.js +1 -1
  11. package/dist/add/add-workflow.d.ts +1 -1
  12. package/dist/inspector.js +1 -1
  13. package/dist/types.d.ts +23 -22
  14. package/dist/utils/compute-required-schemas.d.ts +1 -1
  15. package/dist/utils/contract-hashes.d.ts +2 -1
  16. package/dist/utils/contract-hashes.js +1 -1
  17. package/dist/utils/extract-function-name.js +1 -1
  18. package/dist/utils/extract-services.d.ts +1 -1
  19. package/dist/utils/filter-inspector-state.js +1 -1
  20. package/dist/utils/filter-utils.d.ts +1 -1
  21. package/dist/utils/middleware.d.ts +2 -2
  22. package/dist/utils/middleware.js +5 -5
  23. package/dist/utils/permissions.d.ts +1 -1
  24. package/dist/utils/post-process.d.ts +2 -2
  25. package/dist/utils/post-process.js +6 -6
  26. package/dist/utils/resolve-deploy-target.d.ts +1 -1
  27. package/dist/utils/resolve-function-meta.d.ts +1 -1
  28. package/dist/utils/resolve-function-types.d.ts +1 -1
  29. package/dist/utils/resolve-versions.js +1 -1
  30. package/dist/utils/schema-generator.d.ts +1 -1
  31. package/dist/utils/serialize-inspector-state.d.ts +3 -3
  32. package/dist/utils/serialize-inspector-state.js +4 -4
  33. package/dist/utils/serialize-openapi-json.d.ts +2 -2
  34. package/dist/utils/workflow/derive-workflow-plan.d.ts +1 -1
  35. package/dist/utils/workflow/dsl/extract-dsl-workflow.d.ts +1 -1
  36. package/dist/utils/workflow/graph/convert-dsl-to-graph.d.ts +1 -1
  37. package/dist/utils/workflow/graph/finalize-workflows.js +1 -1
  38. package/dist/utils/workflow/graph/serialize-workflow-graph.js +1 -1
  39. package/dist/utils/workflow/graph/workflow-graph.types.d.ts +2 -2
  40. package/dist/visit.js +4 -4
  41. package/package.json +3 -3
  42. package/src/add/{add-ai-scorer.test.ts → add-agent-scorer.test.ts} +11 -11
  43. package/src/add/{add-ai-scorer.ts → add-agent-scorer.ts} +4 -4
  44. package/src/add/{add-ai-agent.test.ts → add-agent.test.ts} +1 -1
  45. package/src/add/{add-ai-agent.ts → add-agent.ts} +11 -17
  46. package/src/add/add-auth.ts +1 -1
  47. package/src/add/add-channel.ts +4 -1
  48. package/src/add/add-cli.ts +1 -1
  49. package/src/add/add-functions.ts +9 -4
  50. package/src/add/add-gateway.ts +1 -1
  51. package/src/add/add-http-route.ts +1 -1
  52. package/src/add/add-keyed-wiring.ts +1 -1
  53. package/src/add/add-middleware.ts +7 -5
  54. package/src/add/add-permission.ts +1 -1
  55. package/src/add/add-personas.test.ts +2 -2
  56. package/src/add/add-personas.ts +3 -2
  57. package/src/add/add-scenario-step.test.ts +2 -2
  58. package/src/add/add-scope.test.ts +19 -19
  59. package/src/add/add-scope.ts +1 -1
  60. package/src/add/add-system-role.test.ts +12 -12
  61. package/src/add/add-workflow-graph-input.test.ts +1 -1
  62. package/src/add/add-workflow.ts +4 -1
  63. package/src/add/addon-contracts.test.ts +1 -1
  64. package/src/inspector.ts +1 -1
  65. package/src/types.ts +29 -23
  66. package/src/utils/compute-required-schemas.ts +1 -1
  67. package/src/utils/contract-hashes.test.ts +1 -1
  68. package/src/utils/contract-hashes.ts +3 -2
  69. package/src/utils/extract-function-name.ts +1 -1
  70. package/src/utils/extract-services.ts +4 -1
  71. package/src/utils/filter-inspector-state.ts +2 -2
  72. package/src/utils/filter-utils.ts +1 -1
  73. package/src/utils/middleware.test.ts +23 -23
  74. package/src/utils/middleware.ts +6 -6
  75. package/src/utils/permissions.ts +1 -1
  76. package/src/utils/post-process.test.ts +9 -9
  77. package/src/utils/post-process.ts +8 -8
  78. package/src/utils/resolve-deploy-target.ts +1 -1
  79. package/src/utils/resolve-function-meta.ts +4 -1
  80. package/src/utils/resolve-function-types.ts +1 -1
  81. package/src/utils/resolve-versions.ts +5 -2
  82. package/src/utils/schema-generator.ts +3 -2
  83. package/src/utils/serialize-inspector-state.ts +7 -7
  84. package/src/utils/serialize-mcp-json.ts +1 -1
  85. package/src/utils/serialize-openapi-json.ts +2 -2
  86. package/src/utils/workflow/derive-workflow-plan.test.ts +1 -1
  87. package/src/utils/workflow/derive-workflow-plan.ts +1 -1
  88. package/src/utils/workflow/dsl/extract-approval-policy.test.ts +5 -2
  89. package/src/utils/workflow/dsl/extract-dsl-workflow.ts +2 -2
  90. package/src/utils/workflow/graph/convert-dsl-to-graph-skip.test.ts +1 -1
  91. package/src/utils/workflow/graph/convert-dsl-to-graph.ts +4 -1
  92. package/src/utils/workflow/graph/finalize-workflow-wires.ts +1 -1
  93. package/src/utils/workflow/graph/finalize-workflows.ts +6 -2
  94. package/src/utils/workflow/graph/serialize-workflow-graph.ts +1 -1
  95. package/src/utils/workflow/graph/workflow-graph.types.ts +2 -2
  96. package/src/visit.ts +4 -4
  97. package/tsconfig.tsbuildinfo +1 -1
@@ -10,7 +10,10 @@ import {
10
10
  makeContextBasedId,
11
11
  } from '../utils/extract-function-name.js'
12
12
  import { getPropertyAssignmentInitializer } from '../utils/type-utils.js'
13
- import type { ChannelMessageMeta, ChannelMeta } from '@pikku/core/channel'
13
+ import type {
14
+ ChannelMessageMeta,
15
+ ChannelMeta,
16
+ } from '@pikku/core/ecosystem/channel'
14
17
  import type { InspectorState, AddWiring } from '../types.js'
15
18
  import {
16
19
  resolveMiddleware,
@@ -6,7 +6,7 @@ import type {
6
6
  InspectorOptions,
7
7
  InspectorState,
8
8
  } from '../types.js'
9
- import type { CLIProgramMeta, CLICommandMeta } from '@pikku/core/cli'
9
+ import type { CLIProgramMeta, CLICommandMeta } from '@pikku/core/ecosystem/cli'
10
10
  import {
11
11
  extractFunctionName,
12
12
  makeContextBasedId,
@@ -8,9 +8,14 @@ import {
8
8
  } from '../utils/extract-function-name.js'
9
9
  import { extractFunctionNode } from '../utils/extract-function-node.js'
10
10
  import { extractUsedWires } from '../utils/extract-services.js'
11
- import type { AuditDurability, FunctionServicesMeta } from '@pikku/core'
12
- import type { ScenarioStepKind, ScenarioSurface } from '@pikku/core/scenario'
13
- import { formatVersionedId, parseVersionedId } from '@pikku/core'
11
+ import type { AuditDurability } from '@pikku/core/ecosystem/services'
12
+ import type { FunctionServicesMeta } from '@pikku/core/ecosystem/types'
13
+ import type { ScenarioSurface } from '@pikku/core/scenario'
14
+ import type { ScenarioStepKind } from '@pikku/core/ecosystem/scenario'
15
+ import {
16
+ formatVersionedId,
17
+ parseVersionedId,
18
+ } from '@pikku/core/ecosystem/types'
14
19
 
15
20
  /** Binding keys a `pikkuScenarioStep` may declare, in report order. */
16
21
  const SCENARIO_SURFACE_KEYS: readonly ScenarioSurface[] = [
@@ -44,7 +49,7 @@ import { ErrorCode } from '../error-codes.js'
44
49
  import { findPiiPaths } from '../utils/check-pii-output.js'
45
50
  import { findRevealedSecretSinks } from '../utils/check-secret-sinks.js'
46
51
  import { isScenarioInstrumentationFunction } from './scenario-instrumentation.js'
47
- import type { NodeType } from '@pikku/core/node'
52
+ import type { NodeType } from '@pikku/core/ecosystem/node'
48
53
 
49
54
  const isValidVariableName = (name: string) => {
50
55
  const regex = /^[a-zA-Z_$][a-zA-Z0-9_$]*$/
@@ -13,7 +13,7 @@ import { ensureInlineWiringFunction } from '../utils/ensure-function-metadata.js
13
13
  import { resolveMiddleware } from '../utils/middleware.js'
14
14
  import { extractWireNames } from '../utils/post-process.js'
15
15
  import { resolveAddonName } from '../utils/resolve-addon-package.js'
16
- import type { GatewayTransportType } from '@pikku/core/gateway'
16
+ import type { GatewayTransportType } from '@pikku/core/ecosystem/gateway'
17
17
 
18
18
  import { ErrorCode } from '../error-codes.js'
19
19
 
@@ -4,7 +4,7 @@ import {
4
4
  getCommonWireMetaData,
5
5
  } from '../utils/get-property-value.js'
6
6
  import { pathToRegexp } from 'path-to-regexp'
7
- import type { HTTPMethod } from '@pikku/core/http'
7
+ import type { HTTPMethod } from '@pikku/core/ecosystem/http'
8
8
  import {
9
9
  extractFunctionName,
10
10
  makeContextBasedId,
@@ -7,7 +7,7 @@ import {
7
7
  import type { AddWiring, InspectorState } from '../types.js'
8
8
  import { ErrorCode } from '../error-codes.js'
9
9
  import { detectSchemaVendorOrError } from '../utils/detect-schema-vendor.js'
10
- import { parseDurationString } from '@pikku/core'
10
+ import { parseDurationString } from '@pikku/core/ecosystem/types'
11
11
 
12
12
  export interface KeyedWiringConfig {
13
13
  functionName: string
@@ -698,12 +698,14 @@ export const addMiddleware: AddWiring = (logger, node, checker, state) => {
698
698
  return
699
699
  }
700
700
 
701
- if (expression.text === 'pikkuAIMiddleware') {
701
+ if (expression.text === 'pikkuAgentMiddleware') {
702
702
  const arg = args[0]
703
703
  if (!arg) return
704
704
 
705
705
  if (!ts.isObjectLiteralExpression(arg)) {
706
- logger.error(`• pikkuAIMiddleware() requires an object literal argument.`)
706
+ logger.error(
707
+ `• pikkuAgentMiddleware() requires an object literal argument.`
708
+ )
707
709
  return
708
710
  }
709
711
 
@@ -744,13 +746,13 @@ export const addMiddleware: AddWiring = (logger, node, checker, state) => {
744
746
  pikkuFuncId = node.parent.name.text
745
747
  } else {
746
748
  logger.error(
747
- `• pikkuAIMiddleware() must be assigned to a variable or object property. ` +
748
- `Extract it to a const: const myMiddleware = pikkuAIMiddleware(...)`
749
+ `• pikkuAgentMiddleware() must be assigned to a variable or object property. ` +
750
+ `Extract it to a const: const myMiddleware = pikkuAgentMiddleware(...)`
749
751
  )
750
752
  return
751
753
  }
752
754
  }
753
- state.aiMiddleware.definitions[pikkuFuncId] = {
755
+ state.agentMiddleware.definitions[pikkuFuncId] = {
754
756
  services,
755
757
  sourceFile: node.getSourceFile().fileName,
756
758
  position: node.getStart(),
@@ -1,5 +1,5 @@
1
1
  import * as ts from 'typescript'
2
- import type { FunctionWiresMeta } from '@pikku/core'
2
+ import type { FunctionWiresMeta } from '@pikku/core/ecosystem/types'
3
3
  import type { AddWiring } from '../types.js'
4
4
  import { extractFunctionName } from '../utils/extract-function-name.js'
5
5
  import {
@@ -57,8 +57,8 @@ const inspectSources = async (sources: Record<string, string>) => {
57
57
  /** The declared world every persona below is checked against. */
58
58
  const withRoles = (...lines: string[]) =>
59
59
  [
60
- "import { defineScope } from '@pikku/core/scope'",
61
- "import { defineSystemRole } from '@pikku/core/role'",
60
+ "import { defineScope } from '@pikku/core/ecosystem/scope'",
61
+ "import { defineSystemRole } from '@pikku/core/ecosystem/role'",
62
62
  "import { definePersonas } from '@pikku/core/persona'",
63
63
  'defineScope({ catalogue: { scopes: { read: {} } }, admin: {} })',
64
64
  'defineSystemRole({',
@@ -1,7 +1,8 @@
1
1
  import * as ts from 'typescript'
2
- import { DISPOSITIONS } from '@pikku/core/virtual-user'
2
+ import { DISPOSITIONS } from '@pikku/core/ecosystem/virtual-user'
3
3
  import { isRunnablePersona } from '@pikku/core/persona'
4
- import type { PersonaAccountMeta, PersonaMeta } from '@pikku/core/persona'
4
+ import type { PersonaMeta } from '@pikku/core/persona'
5
+ import type { PersonaAccountMeta } from '@pikku/core/ecosystem/persona'
5
6
  import { ErrorCode } from '../error-codes.js'
6
7
  import { claimSingleDeclaration } from '../utils/single-declaration.js'
7
8
  import type { AddWiring, InspectorLogger } from '../types.js'
@@ -5,8 +5,8 @@ import { tmpdir } from 'node:os'
5
5
  import { join } from 'node:path'
6
6
  import { inspect } from '../inspector.js'
7
7
  import type { InspectorLogger } from '../types.js'
8
- import type { WorkflowStepMeta } from '@pikku/core/workflow'
9
- import type { ScenarioStepMeta } from '@pikku/core/scenario'
8
+ import type { WorkflowStepMeta } from '@pikku/core/ecosystem/workflow'
9
+ import type { ScenarioStepMeta } from '@pikku/core/ecosystem/scenario'
10
10
 
11
11
  function makeLogger(
12
12
  criticals: Array<{ code: string; message: string }>
@@ -58,7 +58,7 @@ describe('addScope inspector', () => {
58
58
  test('extracts a flat scope', async () => {
59
59
  const { state, criticals } = await inspectSource(
60
60
  [
61
- "import { defineScope } from '@pikku/core/scope'",
61
+ "import { defineScope } from '@pikku/core/ecosystem/scope'",
62
62
  'defineScope({',
63
63
  ' admin: {',
64
64
  " displayName: 'Administration',",
@@ -81,7 +81,7 @@ describe('addScope inspector', () => {
81
81
  test('extracts a displayName at every depth', async () => {
82
82
  const { state, criticals } = await inspectSource(
83
83
  [
84
- "import { defineScope } from '@pikku/core/scope'",
84
+ "import { defineScope } from '@pikku/core/ecosystem/scope'",
85
85
  'defineScope({',
86
86
  ' admin: {',
87
87
  " displayName: 'Administration',",
@@ -109,7 +109,7 @@ describe('addScope inspector', () => {
109
109
  test('extracts a nested scope tree', async () => {
110
110
  const { state, criticals } = await inspectSource(
111
111
  [
112
- "import { defineScope } from '@pikku/core/scope'",
112
+ "import { defineScope } from '@pikku/core/ecosystem/scope'",
113
113
  'defineScope({',
114
114
  ' admin: {',
115
115
  ' scopes: {',
@@ -139,7 +139,7 @@ describe('addScope inspector', () => {
139
139
  test('records the source file', async () => {
140
140
  const { state, file } = await inspectSource(
141
141
  [
142
- "import { defineScope } from '@pikku/core/scope'",
142
+ "import { defineScope } from '@pikku/core/ecosystem/scope'",
143
143
  'defineScope({ admin: {} })',
144
144
  ].join('\n')
145
145
  )
@@ -153,7 +153,7 @@ describe('addScope inspector', () => {
153
153
  test('extracts several roots from one declaration', async () => {
154
154
  const { state, criticals } = await inspectSource(
155
155
  [
156
- "import { defineScope } from '@pikku/core/scope'",
156
+ "import { defineScope } from '@pikku/core/ecosystem/scope'",
157
157
  'defineScope({ admin: {}, billing: { scopes: { read: {} } } })',
158
158
  ].join('\n')
159
159
  )
@@ -169,7 +169,7 @@ describe('addScope inspector', () => {
169
169
  test('extracts several declarations', async () => {
170
170
  const { state } = await inspectSource(
171
171
  [
172
- "import { defineScope } from '@pikku/core/scope'",
172
+ "import { defineScope } from '@pikku/core/ecosystem/scope'",
173
173
  'defineScope({ admin: {} })',
174
174
  'defineScope({ billing: {} })',
175
175
  ].join('\n')
@@ -188,11 +188,11 @@ describe('addScope inspector', () => {
188
188
  test('declarations in separate files all survive', async () => {
189
189
  const { state, criticals } = await inspectSources({
190
190
  'user-admin.gen.ts': [
191
- "import { defineScope } from '@pikku/core/scope'",
191
+ "import { defineScope } from '@pikku/core/ecosystem/scope'",
192
192
  'defineScope({ admin: {} })',
193
193
  ].join('\n'),
194
194
  'scopes.ts': [
195
- "import { defineScope } from '@pikku/core/scope'",
195
+ "import { defineScope } from '@pikku/core/ecosystem/scope'",
196
196
  'defineScope({ billing: {} })',
197
197
  ].join('\n'),
198
198
  })
@@ -202,10 +202,10 @@ describe('addScope inspector', () => {
202
202
  [],
203
203
  `expected no duplicate critical, got ${JSON.stringify(criticals)}`
204
204
  )
205
- assert.deepEqual(
206
- state.scopes.definitions.map((d) => d.name).sort(),
207
- ['admin', 'billing']
208
- )
205
+ assert.deepEqual(state.scopes.definitions.map((d) => d.name).sort(), [
206
+ 'admin',
207
+ 'billing',
208
+ ])
209
209
  })
210
210
 
211
211
  // The CLI scaffolds a scope tree of its own — `user-admin.gen.ts` declares the
@@ -214,11 +214,11 @@ describe('addScope inspector', () => {
214
214
  test('a generated declaration neither claims the slot nor conflicts', async () => {
215
215
  const { state, criticals } = await inspectSources({
216
216
  'user-admin.gen.ts': [
217
- "import { defineScope } from '@pikku/core/scope'",
217
+ "import { defineScope } from '@pikku/core/ecosystem/scope'",
218
218
  'defineScope({ admin: {} })',
219
219
  ].join('\n'),
220
220
  'scopes.ts': [
221
- "import { defineScope } from '@pikku/core/scope'",
221
+ "import { defineScope } from '@pikku/core/ecosystem/scope'",
222
222
  'defineScope({ billing: {} })',
223
223
  ].join('\n'),
224
224
  })
@@ -238,7 +238,7 @@ describe('addScope inspector', () => {
238
238
  test('is critical when a root embeds the separator', async () => {
239
239
  const { criticals } = await inspectSource(
240
240
  [
241
- "import { defineScope } from '@pikku/core/scope'",
241
+ "import { defineScope } from '@pikku/core/ecosystem/scope'",
242
242
  "defineScope({ 'admin:users': {} })",
243
243
  ].join('\n')
244
244
  )
@@ -252,7 +252,7 @@ describe('addScope inspector', () => {
252
252
  test('is critical when a root is the wildcard', async () => {
253
253
  const { criticals } = await inspectSource(
254
254
  [
255
- "import { defineScope } from '@pikku/core/scope'",
255
+ "import { defineScope } from '@pikku/core/ecosystem/scope'",
256
256
  "defineScope({ '*': {} })",
257
257
  ].join('\n')
258
258
  )
@@ -266,7 +266,7 @@ describe('addScope inspector', () => {
266
266
  test('is critical when a root key is not a literal', async () => {
267
267
  const { criticals } = await inspectSource(
268
268
  [
269
- "import { defineScope } from '@pikku/core/scope'",
269
+ "import { defineScope } from '@pikku/core/ecosystem/scope'",
270
270
  'const k = String(1)',
271
271
  'defineScope({ [k]: {} } as any)',
272
272
  ].join('\n')
@@ -281,7 +281,7 @@ describe('addScope inspector', () => {
281
281
  test('is critical when a root is not an object literal', async () => {
282
282
  const { criticals } = await inspectSource(
283
283
  [
284
- "import { defineScope } from '@pikku/core/scope'",
284
+ "import { defineScope } from '@pikku/core/ecosystem/scope'",
285
285
  "defineScope({ admin: 'nope' } as any)",
286
286
  ].join('\n')
287
287
  )
@@ -296,7 +296,7 @@ describe('addScope inspector', () => {
296
296
  describe('validateScopeReferences', () => {
297
297
  const funcSource = (scopes: string, decls: string[] = []) =>
298
298
  [
299
- "import { defineScope } from '@pikku/core/scope'",
299
+ "import { defineScope } from '@pikku/core/ecosystem/scope'",
300
300
  "import { pikkuSessionlessFunc } from '@pikku/core'",
301
301
  ...decls,
302
302
  'export const f = pikkuSessionlessFunc({',
@@ -2,7 +2,7 @@ import * as ts from 'typescript'
2
2
  import { getPropertyValue } from '../utils/get-property-value.js'
3
3
  import type { AddWiring, InspectorLogger } from '../types.js'
4
4
  import { ErrorCode } from '../error-codes.js'
5
- import type { ScopeNodeMeta } from '@pikku/core/scope'
5
+ import type { ScopeNodeMeta } from '@pikku/core/ecosystem/scope'
6
6
 
7
7
  const SEPARATOR = ':'
8
8
  const WILDCARD = '*'
@@ -55,8 +55,8 @@ const inspectSources = async (sources: Record<string, string>) => {
55
55
  }
56
56
 
57
57
  const IMPORTS = [
58
- "import { defineScope } from '@pikku/core/scope'",
59
- "import { defineSystemRole } from '@pikku/core/role'",
58
+ "import { defineScope } from '@pikku/core/ecosystem/scope'",
59
+ "import { defineSystemRole } from '@pikku/core/ecosystem/role'",
60
60
  ]
61
61
 
62
62
  const withScopes = (...lines: string[]) =>
@@ -118,10 +118,10 @@ describe('addSystemRole inspector', () => {
118
118
  )
119
119
  )
120
120
 
121
- assert.deepEqual(
122
- state.systemRoles.definitions.map((r) => r.name).sort(),
123
- ['admin', 'buyer']
124
- )
121
+ assert.deepEqual(state.systemRoles.definitions.map((r) => r.name).sort(), [
122
+ 'admin',
123
+ 'buyer',
124
+ ])
125
125
  })
126
126
 
127
127
  // Roles follow scopes: a project scaffolding user-admin has a generated
@@ -132,7 +132,7 @@ describe('addSystemRole inspector', () => {
132
132
  "defineSystemRole({ buyer: { scopes: ['catalogue:read'] } })"
133
133
  ),
134
134
  'more-roles.ts': [
135
- "import { defineSystemRole } from '@pikku/core/role'",
135
+ "import { defineSystemRole } from '@pikku/core/ecosystem/role'",
136
136
  "defineSystemRole({ admin: { scopes: ['admin'] } })",
137
137
  ].join('\n'),
138
138
  })
@@ -142,10 +142,10 @@ describe('addSystemRole inspector', () => {
142
142
  [],
143
143
  `expected no duplicate critical, got ${JSON.stringify(criticals)}`
144
144
  )
145
- assert.deepEqual(
146
- state.systemRoles.definitions.map((r) => r.name).sort(),
147
- ['admin', 'buyer']
148
- )
145
+ assert.deepEqual(state.systemRoles.definitions.map((r) => r.name).sort(), [
146
+ 'admin',
147
+ 'buyer',
148
+ ])
149
149
  })
150
150
 
151
151
  // A generated file is not the one place a person adds a role to, so it neither
@@ -153,7 +153,7 @@ describe('addSystemRole inspector', () => {
153
153
  test('a generated declaration neither claims the slot nor conflicts', async () => {
154
154
  const { state, criticals } = await inspectSources({
155
155
  'roles.gen.ts': [
156
- "import { defineSystemRole } from '@pikku/core/role'",
156
+ "import { defineSystemRole } from '@pikku/core/ecosystem/role'",
157
157
  'defineSystemRole({ admin: { scopes: [] } })',
158
158
  ].join('\n'),
159
159
  'roles.ts': withScopes(
@@ -36,7 +36,7 @@ describe('addWorkflowGraph — node input extraction', () => {
36
36
  graphFile,
37
37
  [
38
38
  "import { pikkuWorkflowGraph } from '@pikku/core/workflow'",
39
- "import { template } from '@pikku/core/workflow'",
39
+ "import { template } from '@pikku/core/ecosystem/workflow'",
40
40
  'export const myGraph = pikkuWorkflowGraph({',
41
41
  " name: 'input-graph',",
42
42
  " nodes: { edit: 'edit' },",
@@ -3,7 +3,10 @@ import type { AddWiring, InspectorState } from '../types.js'
3
3
  import { extractFunctionName } from '../utils/extract-function-name.js'
4
4
  import { extractFunctionNode } from '../utils/extract-function-node.js'
5
5
  import { ErrorCode } from '../error-codes.js'
6
- import type { WorkflowStepMeta, WorkflowContext } from '@pikku/core/workflow'
6
+ import type {
7
+ WorkflowStepMeta,
8
+ WorkflowContext,
9
+ } from '@pikku/core/ecosystem/workflow'
7
10
  import {
8
11
  extractStringLiteral,
9
12
  isStringLike,
@@ -178,7 +178,7 @@ describe('addon contract metadata', () => {
178
178
  await writeFile(
179
179
  appFile,
180
180
  [
181
- "import { wireAddon } from '@pikku/core/rpc'",
181
+ "import { wireAddon } from '@pikku/core/ecosystem/rpc'",
182
182
  "import { wireHTTPRoutes } from '@pikku/core/http'",
183
183
  "import { wireChannel } from '@pikku/core/channel'",
184
184
  "import { wireCLI } from '@pikku/core/cli'",
package/src/inspector.ts CHANGED
@@ -221,7 +221,7 @@ export function getInitialInspectorState(rootDir: string): InspectorState {
221
221
  instances: {},
222
222
  tagMiddleware: new Map(),
223
223
  },
224
- aiMiddleware: {
224
+ agentMiddleware: {
225
225
  definitions: {},
226
226
  },
227
227
  permissions: {
package/src/types.ts CHANGED
@@ -1,35 +1,41 @@
1
1
  import type * as ts from 'typescript'
2
2
  import type { SecretUsage } from './utils/extract-secret-usage.js'
3
- import type { ChannelMessageMeta, ChannelsMeta } from '@pikku/core/channel'
4
- import type { GatewaysMeta } from '@pikku/core/gateway'
5
- import type { HTTPWiringsMeta } from '@pikku/core/http'
6
- import type { ScheduledTasksMeta } from '@pikku/core/scheduler'
7
- import type { TriggerMeta, TriggerSourceMeta } from '@pikku/core/trigger'
8
- import type { QueueWorkersMeta } from '@pikku/core/queue'
9
- import type { WorkflowsMeta } from '@pikku/core/workflow'
3
+ import type {
4
+ ChannelMessageMeta,
5
+ ChannelsMeta,
6
+ } from '@pikku/core/ecosystem/channel'
7
+ import type { GatewaysMeta } from '@pikku/core/ecosystem/gateway'
8
+ import type { HTTPWiringsMeta } from '@pikku/core/ecosystem/http'
9
+ import type { ScheduledTasksMeta } from '@pikku/core/ecosystem/scheduler'
10
+ import type {
11
+ TriggerMeta,
12
+ TriggerSourceMeta,
13
+ } from '@pikku/core/ecosystem/trigger'
14
+ import type { QueueWorkersMeta } from '@pikku/core/ecosystem/queue'
15
+ import type { WorkflowsMeta } from '@pikku/core/ecosystem/workflow'
10
16
  import type {
11
17
  MCPResourceMeta,
12
18
  MCPToolMeta,
13
19
  MCPPromptMeta,
14
- } from '@pikku/core/mcp'
15
- import type { AIAgentMeta } from '@pikku/core/ai-agent'
16
- import type { ScorerMeta } from '@pikku/core/ai-scorer'
17
- import type { CLIMeta } from '@pikku/core/cli'
18
- import type { CLICommandMeta } from '@pikku/core/cli'
19
- import type { NodesMeta } from '@pikku/core/node'
20
- import type { SecretDefinitions } from '@pikku/core/secret'
21
- import type { CredentialDefinitions } from '@pikku/core/credential'
22
- import type { ScopeDefinitions } from '@pikku/core/scope'
23
- import type { SystemRoleDefinitions } from '@pikku/core/role'
24
- import type { PersonaDefinitions } from '@pikku/core/persona'
25
- import type { VariableDefinitions } from '@pikku/core/variable'
20
+ } from '@pikku/core/ecosystem/mcp'
21
+ import type { AgentsMeta } from '@pikku/core/ecosystem/agent'
22
+ import type { ScorerMeta } from '@pikku/core/ecosystem/agent-scorer'
23
+ import type { CLIMeta } from '@pikku/core/ecosystem/cli'
24
+ import type { CLICommandMeta } from '@pikku/core/ecosystem/cli'
25
+ import type { NodesMeta } from '@pikku/core/ecosystem/node'
26
+ import type { SecretDefinitions } from '@pikku/core/ecosystem/secret'
27
+ import type { CredentialDefinitions } from '@pikku/core/ecosystem/credential'
28
+ import type { ScopeDefinitions } from '@pikku/core/ecosystem/scope'
29
+ import type { SystemRoleDefinitions } from '@pikku/core/ecosystem/role'
30
+ import type { PersonaDefinitions } from '@pikku/core/ecosystem/persona'
31
+ import type { VariableDefinitions } from '@pikku/core/ecosystem/variable'
26
32
  import type { TypesMap } from './types-map.js'
33
+ import type { FunctionsMeta } from '@pikku/core/ecosystem/services'
27
34
  import type {
28
- FunctionsMeta,
29
35
  FunctionServicesMeta,
30
36
  FunctionWiresMeta,
31
37
  JSONValue,
32
- } from '@pikku/core'
38
+ } from '@pikku/core/ecosystem/types'
33
39
  import type { OpenAPISpecInfo } from './utils/serialize-openapi-json.js'
34
40
  import type { ErrorCode, CodedDiagnostic } from './error-codes.js'
35
41
  import type {
@@ -613,7 +619,7 @@ export interface InspectorState {
613
619
  files: Set<string>
614
620
  }
615
621
  agents: {
616
- agentsMeta: AIAgentMeta
622
+ agentsMeta: AgentsMeta
617
623
  files: Map<string, { path: string; exportedName: string }>
618
624
  }
619
625
  scorers: {
@@ -681,7 +687,7 @@ export interface InspectorState {
681
687
  }
682
688
  middleware: InspectorMiddlewareState
683
689
  channelMiddleware: InspectorChannelMiddlewareState
684
- aiMiddleware: InspectorAIMiddlewareState
690
+ agentMiddleware: InspectorAIMiddlewareState
685
691
  permissions: InspectorPermissionState
686
692
  serviceAggregation: {
687
693
  requiredServices: Set<string>
@@ -1,4 +1,4 @@
1
- import type { FunctionsMeta } from '@pikku/core'
1
+ import type { FunctionsMeta } from '@pikku/core/ecosystem/services'
2
2
  import type { TypesMap } from '../types-map.js'
3
3
  import type { SchemaRef } from '../types.js'
4
4
 
@@ -10,7 +10,7 @@ import {
10
10
  extractContractsFromMeta,
11
11
  } from './contract-hashes.js'
12
12
  import type { ContractEntry, VersionManifest } from './contract-hashes.js'
13
- import type { FunctionsMeta } from '@pikku/core'
13
+ import type { FunctionsMeta } from '@pikku/core/ecosystem/services'
14
14
  import { ErrorCode } from '../error-codes.js'
15
15
 
16
16
  function makeContracts(
@@ -1,5 +1,6 @@
1
- import type { FunctionsMeta, JSONValue } from '@pikku/core'
2
- import { parseVersionedId } from '@pikku/core'
1
+ import type { FunctionsMeta } from '@pikku/core/ecosystem/services'
2
+ import type { JSONValue } from '@pikku/core/ecosystem/types'
3
+ import { parseVersionedId } from '@pikku/core/ecosystem/types'
3
4
  import type { TypesMap } from '../types-map.js'
4
5
  import { ErrorCode } from '../error-codes.js'
5
6
  import { canonicalJSON, hashString } from './hash.js'
@@ -1,7 +1,7 @@
1
1
  import * as ts from 'typescript'
2
2
  import { createHash } from 'crypto'
3
3
  import { relative } from 'path'
4
- import { formatVersionedId } from '@pikku/core'
4
+ import { formatVersionedId } from '@pikku/core/ecosystem/types'
5
5
 
6
6
  /**
7
7
  * Deterministic placeholder id for an anonymous/unnamed pikku function or
@@ -1,5 +1,8 @@
1
1
  import * as ts from 'typescript'
2
- import type { FunctionServicesMeta, FunctionWiresMeta } from '@pikku/core'
2
+ import type {
3
+ FunctionServicesMeta,
4
+ FunctionWiresMeta,
5
+ } from '@pikku/core/ecosystem/types'
3
6
 
4
7
  /**
5
8
  * Extract services from a function's first parameter destructuring pattern
@@ -3,8 +3,8 @@ import type {
3
3
  InspectorFilters,
4
4
  InspectorLogger,
5
5
  } from '../types.js'
6
- import type { PikkuWiringTypes } from '@pikku/core'
7
- import { parseVersionedId } from '@pikku/core'
6
+ import type { PikkuWiringTypes } from '@pikku/core/ecosystem/types'
7
+ import { parseVersionedId } from '@pikku/core/ecosystem/types'
8
8
  import { aggregateRequiredServices } from './post-process.js'
9
9
  import { resolveDeployTarget } from './resolve-deploy-target.js'
10
10
 
@@ -1,5 +1,5 @@
1
1
  import type { InspectorFilters, InspectorLogger } from '../types.js'
2
- import type { PikkuWiringTypes } from '@pikku/core'
2
+ import type { PikkuWiringTypes } from '@pikku/core/ecosystem/types'
3
3
 
4
4
  /**
5
5
  * Match a value against a pattern with wildcard support