@contractspec/bundle.lifecycle-managed 1.56.1 → 1.58.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/dist/__tests__/assessment-service.test.d.ts +2 -0
- package/dist/__tests__/assessment-service.test.d.ts.map +1 -0
- package/dist/agents/lifecycle-advisor-agent.d.ts +1 -7
- package/dist/agents/lifecycle-advisor-agent.d.ts.map +1 -1
- package/dist/api/rest-handlers.d.ts +14 -17
- package/dist/api/rest-handlers.d.ts.map +1 -1
- package/dist/browser/index.js +213 -0
- package/dist/events/lifecycle-events.d.ts +9 -13
- package/dist/events/lifecycle-events.d.ts.map +1 -1
- package/dist/index.d.ts +5 -5
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +213 -5
- package/dist/node/index.js +213 -0
- package/dist/services/assessment-service.d.ts +39 -44
- package/dist/services/assessment-service.d.ts.map +1 -1
- package/package.json +25 -20
- package/dist/agents/lifecycle-advisor-agent.js +0 -71
- package/dist/agents/lifecycle-advisor-agent.js.map +0 -1
- package/dist/api/rest-handlers.js +0 -23
- package/dist/api/rest-handlers.js.map +0 -1
- package/dist/events/lifecycle-events.js +0 -45
- package/dist/events/lifecycle-events.js.map +0 -1
- package/dist/libs/ai-agent/src/agent/contract-spec-agent.d.ts +0 -5
- package/dist/libs/ai-agent/src/agent/index.d.ts +0 -2
- package/dist/libs/ai-agent/src/agent/unified-agent.d.ts +0 -3
- package/dist/libs/ai-agent/src/approval/index.d.ts +0 -1
- package/dist/libs/ai-agent/src/approval/workflow.d.ts +0 -1
- package/dist/libs/ai-agent/src/exporters/claude-agent-exporter.d.ts +0 -2
- package/dist/libs/ai-agent/src/exporters/index.d.ts +0 -3
- package/dist/libs/ai-agent/src/exporters/opencode-exporter.d.ts +0 -2
- package/dist/libs/ai-agent/src/exporters/types.d.ts +0 -2
- package/dist/libs/ai-agent/src/index.d.ts +0 -14
- package/dist/libs/ai-agent/src/interop/index.d.ts +0 -3
- package/dist/libs/ai-agent/src/interop/spec-consumer.d.ts +0 -2
- package/dist/libs/ai-agent/src/interop/tool-consumer.d.ts +0 -3
- package/dist/libs/ai-agent/src/interop/types.d.ts +0 -2
- package/dist/libs/ai-agent/src/knowledge/index.d.ts +0 -1
- package/dist/libs/ai-agent/src/knowledge/injector.d.ts +0 -1
- package/dist/libs/ai-agent/src/providers/claude-agent-sdk/adapter.d.ts +0 -2
- package/dist/libs/ai-agent/src/providers/claude-agent-sdk/index.d.ts +0 -3
- package/dist/libs/ai-agent/src/providers/claude-agent-sdk/session-bridge.d.ts +0 -1
- package/dist/libs/ai-agent/src/providers/claude-agent-sdk/tool-bridge.d.ts +0 -3
- package/dist/libs/ai-agent/src/providers/index.d.ts +0 -4
- package/dist/libs/ai-agent/src/providers/opencode-sdk/adapter.d.ts +0 -2
- package/dist/libs/ai-agent/src/providers/opencode-sdk/agent-bridge.d.ts +0 -3
- package/dist/libs/ai-agent/src/providers/opencode-sdk/index.d.ts +0 -3
- package/dist/libs/ai-agent/src/providers/opencode-sdk/tool-bridge.d.ts +0 -3
- package/dist/libs/ai-agent/src/providers/registry.d.ts +0 -1
- package/dist/libs/ai-agent/src/providers/types.d.ts +0 -3
- package/dist/libs/ai-agent/src/schema/index.d.ts +0 -2
- package/dist/libs/ai-agent/src/schema/json-schema-to-zod.d.ts +0 -1
- package/dist/libs/ai-agent/src/schema/schema-output.d.ts +0 -2
- package/dist/libs/ai-agent/src/session/index.d.ts +0 -1
- package/dist/libs/ai-agent/src/session/store.d.ts +0 -2
- package/dist/libs/ai-agent/src/spec/index.d.ts +0 -2
- package/dist/libs/ai-agent/src/spec/registry.d.ts +0 -2
- package/dist/libs/ai-agent/src/spec/spec.d.ts +0 -115
- package/dist/libs/ai-agent/src/spec/spec.d.ts.map +0 -1
- package/dist/libs/ai-agent/src/telemetry/adapter.d.ts +0 -1
- package/dist/libs/ai-agent/src/telemetry/index.d.ts +0 -1
- package/dist/libs/ai-agent/src/tools/index.d.ts +0 -4
- package/dist/libs/ai-agent/src/tools/knowledge-tool.d.ts +0 -2
- package/dist/libs/ai-agent/src/tools/mcp-client.d.ts +0 -1
- package/dist/libs/ai-agent/src/tools/mcp-server.d.ts +0 -3
- package/dist/libs/ai-agent/src/tools/tool-adapter.d.ts +0 -3
- package/dist/libs/ai-agent/src/types.d.ts +0 -1
- package/dist/libs/contracts/src/app-config/lifecycle.d.ts +0 -1
- package/dist/libs/contracts/src/app-config/runtime.d.ts +0 -13
- package/dist/libs/contracts/src/app-config/spec.d.ts +0 -9
- package/dist/libs/contracts/src/capabilities/capabilities.d.ts +0 -1
- package/dist/libs/contracts/src/capabilities/context.d.ts +0 -1
- package/dist/libs/contracts/src/capabilities/guards.d.ts +0 -4
- package/dist/libs/contracts/src/capabilities/index.d.ts +0 -5
- package/dist/libs/contracts/src/capabilities/openbanking.d.ts +0 -1
- package/dist/libs/contracts/src/capabilities/validation.d.ts +0 -4
- package/dist/libs/contracts/src/data-views/index.d.ts +0 -3
- package/dist/libs/contracts/src/data-views/registry.d.ts +0 -2
- package/dist/libs/contracts/src/data-views/report/contractVerificationTable.d.ts +0 -1
- package/dist/libs/contracts/src/data-views/spec.d.ts +0 -3
- package/dist/libs/contracts/src/data-views/types.d.ts +0 -2
- package/dist/libs/contracts/src/docs/accessibility_wcag_compliance_specs.docblock.d.ts +0 -1
- package/dist/libs/contracts/src/docs/commands/docsGenerate.command.d.ts +0 -1
- package/dist/libs/contracts/src/docs/commands/docsPublish.command.d.ts +0 -1
- package/dist/libs/contracts/src/docs/commands/index.d.ts +0 -2
- package/dist/libs/contracts/src/docs/contracts.d.ts +0 -6
- package/dist/libs/contracts/src/docs/events/docsGenerated.event.d.ts +0 -1
- package/dist/libs/contracts/src/docs/events/docsPublished.event.d.ts +0 -1
- package/dist/libs/contracts/src/docs/events/index.d.ts +0 -2
- package/dist/libs/contracts/src/docs/forms/docsSearch.form.d.ts +0 -1
- package/dist/libs/contracts/src/docs/forms/index.d.ts +0 -1
- package/dist/libs/contracts/src/docs/index.d.ts +0 -30
- package/dist/libs/contracts/src/docs/presentations.d.ts +0 -2
- package/dist/libs/contracts/src/docs/queries/contractReference.query.d.ts +0 -1
- package/dist/libs/contracts/src/docs/queries/docsIndex.query.d.ts +0 -1
- package/dist/libs/contracts/src/docs/queries/index.d.ts +0 -2
- package/dist/libs/contracts/src/docs/registry.d.ts +0 -10
- package/dist/libs/contracts/src/docs/registry.d.ts.map +0 -1
- package/dist/libs/contracts/src/docs/tech/auth/better-auth-nextjs.docblock.d.ts +0 -1
- package/dist/libs/contracts/src/docs/tech/contracts/README.docblock.d.ts +0 -1
- package/dist/libs/contracts/src/docs/tech/contracts/openapi-export.docblock.d.ts +0 -1
- package/dist/libs/contracts/src/docs/tech/contracts/openapi-import.docblock.d.ts +0 -1
- package/dist/libs/contracts/src/docs/tech/lifecycle-stage-system.docblock.d.ts +0 -1
- package/dist/libs/contracts/src/docs/tech/llm/llm-integration.docblock.d.ts +0 -1
- package/dist/libs/contracts/src/docs/tech/mcp-endpoints.docblock.d.ts +0 -1
- package/dist/libs/contracts/src/docs/tech/presentation-runtime.docblock.d.ts +0 -1
- package/dist/libs/contracts/src/docs/tech/schema/README.docblock.d.ts +0 -1
- package/dist/libs/contracts/src/docs/tech/studio/learning-events.docblock.d.ts +0 -1
- package/dist/libs/contracts/src/docs/tech/studio/learning-journeys.docblock.d.ts +0 -1
- package/dist/libs/contracts/src/docs/tech/studio/platform-admin-panel.docblock.d.ts +0 -1
- package/dist/libs/contracts/src/docs/tech/studio/project-access-teams.docblock.d.ts +0 -1
- package/dist/libs/contracts/src/docs/tech/studio/project-routing.docblock.d.ts +0 -1
- package/dist/libs/contracts/src/docs/tech/studio/sandbox-unlogged.docblock.d.ts +0 -1
- package/dist/libs/contracts/src/docs/tech/studio/team-invitations.docblock.d.ts +0 -1
- package/dist/libs/contracts/src/docs/tech/studio/workspace-ops.docblock.d.ts +0 -1
- package/dist/libs/contracts/src/docs/tech/studio/workspaces.docblock.d.ts +0 -1
- package/dist/libs/contracts/src/docs/tech/telemetry-ingest.docblock.d.ts +0 -1
- package/dist/libs/contracts/src/docs/tech/vscode-extension.docblock.d.ts +0 -1
- package/dist/libs/contracts/src/events.d.ts +0 -5
- package/dist/libs/contracts/src/experiments/spec-resolver.d.ts +0 -4
- package/dist/libs/contracts/src/experiments/spec.d.ts +0 -4
- package/dist/libs/contracts/src/features/index.d.ts +0 -4
- package/dist/libs/contracts/src/features/install.d.ts +0 -6
- package/dist/libs/contracts/src/features/registry.d.ts +0 -2
- package/dist/libs/contracts/src/features/types.d.ts +0 -5
- package/dist/libs/contracts/src/features/validation.d.ts +0 -2
- package/dist/libs/contracts/src/forms/forms.d.ts +0 -3
- package/dist/libs/contracts/src/forms/index.d.ts +0 -1
- package/dist/libs/contracts/src/install.d.ts +0 -7
- package/dist/libs/contracts/src/integrations/connection.d.ts +0 -1
- package/dist/libs/contracts/src/integrations/spec.d.ts +0 -3
- package/dist/libs/contracts/src/knowledge/spec.d.ts +0 -9
- package/dist/libs/contracts/src/knowledge/spec.d.ts.map +0 -1
- package/dist/libs/contracts/src/operations/index.d.ts +0 -3
- package/dist/libs/contracts/src/operations/operation.d.ts +0 -7
- package/dist/libs/contracts/src/operations/registry.d.ts +0 -6
- package/dist/libs/contracts/src/operations/report/getContractVerificationStatus.d.ts +0 -3
- package/dist/libs/contracts/src/operations/report/index.d.ts +0 -4
- package/dist/libs/contracts/src/ownership.d.ts +0 -164
- package/dist/libs/contracts/src/ownership.d.ts.map +0 -1
- package/dist/libs/contracts/src/policy/registry.d.ts +0 -2
- package/dist/libs/contracts/src/policy/spec.d.ts +0 -13
- package/dist/libs/contracts/src/policy/spec.d.ts.map +0 -1
- package/dist/libs/contracts/src/presentations/index.d.ts +0 -3
- package/dist/libs/contracts/src/presentations/presentations.d.ts +0 -3
- package/dist/libs/contracts/src/presentations/registry.d.ts +0 -2
- package/dist/libs/contracts/src/presentations/transform-engine.d.ts +0 -2
- package/dist/libs/contracts/src/registry-utils.d.ts +0 -1
- package/dist/libs/contracts/src/registry.d.ts +0 -3
- package/dist/libs/contracts/src/resources.d.ts +0 -2
- package/dist/libs/contracts/src/telemetry/anomaly.d.ts +0 -2
- package/dist/libs/contracts/src/telemetry/index.d.ts +0 -3
- package/dist/libs/contracts/src/telemetry/spec.d.ts +0 -2
- package/dist/libs/contracts/src/telemetry/tracker.d.ts +0 -3
- package/dist/libs/contracts/src/tests/spec.d.ts +0 -1
- package/dist/libs/contracts/src/themes.d.ts +0 -2
- package/dist/libs/contracts/src/types.d.ts +0 -5
- package/dist/libs/contracts/src/versioning/refs.d.ts +0 -28
- package/dist/libs/contracts/src/versioning/refs.d.ts.map +0 -1
- package/dist/libs/contracts/src/workflow/overview.docblock.d.ts +0 -1
- package/dist/libs/contracts/src/workflow/spec.d.ts +0 -5
- package/dist/libs/contracts/src/workspace-config/workspace-config.docblock.d.ts +0 -1
- package/dist/libs/schema/src/EnumType.d.ts +0 -2
- package/dist/libs/schema/src/FieldType.d.ts +0 -2
- package/dist/libs/schema/src/GraphQLSchemaType.d.ts +0 -2
- package/dist/libs/schema/src/JsonSchemaType.d.ts +0 -2
- package/dist/libs/schema/src/ScalarTypeEnum.d.ts +0 -1
- package/dist/libs/schema/src/SchemaModel.d.ts +0 -4
- package/dist/libs/schema/src/SchemaModelType.d.ts +0 -1
- package/dist/libs/schema/src/ZodSchemaType.d.ts +0 -2
- package/dist/libs/schema/src/entity/defineEntity.d.ts +0 -1
- package/dist/libs/schema/src/entity/generator.d.ts +0 -1
- package/dist/libs/schema/src/entity/index.d.ts +0 -3
- package/dist/libs/schema/src/entity/types.d.ts +0 -1
- package/dist/libs/schema/src/index.d.ts +0 -9
- package/dist/services/assessment-service.js +0 -64
- package/dist/services/assessment-service.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assessment-service.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/assessment-service.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,8 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import "../libs/ai-agent/src/index.js";
|
|
3
|
-
|
|
4
|
-
//#region src/agents/lifecycle-advisor-agent.d.ts
|
|
5
|
-
declare const LifecycleAdvisorAgent: AgentSpec;
|
|
6
|
-
//#endregion
|
|
7
|
-
export { LifecycleAdvisorAgent };
|
|
1
|
+
export declare const LifecycleAdvisorAgent: import("@contractspec/lib.ai-agent").AgentSpec;
|
|
8
2
|
//# sourceMappingURL=lifecycle-advisor-agent.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lifecycle-advisor-agent.d.ts","
|
|
1
|
+
{"version":3,"file":"lifecycle-advisor-agent.d.ts","sourceRoot":"","sources":["../../src/agents/lifecycle-advisor-agent.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,qBAAqB,gDAgEhC,CAAC"}
|
|
@@ -1,21 +1,18 @@
|
|
|
1
|
-
import { LifecycleAssessmentRequest, LifecycleAssessmentResponse
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
query?: Record<string, string | undefined>;
|
|
1
|
+
import type { LifecycleAssessmentRequest, LifecycleAssessmentResponse } from '../services/assessment-service';
|
|
2
|
+
import { LifecycleAssessmentService } from '../services/assessment-service';
|
|
3
|
+
export interface HttpRequest<TBody = unknown, TParams = Record<string, string>> {
|
|
4
|
+
body?: TBody;
|
|
5
|
+
params?: TParams;
|
|
6
|
+
query?: Record<string, string | undefined>;
|
|
8
7
|
}
|
|
9
|
-
interface HttpResponse<T = Record<string, unknown>> {
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
export interface HttpResponse<T = Record<string, unknown>> {
|
|
9
|
+
status: number;
|
|
10
|
+
body: T;
|
|
12
11
|
}
|
|
13
|
-
declare const createLifecycleHandlers: (service: LifecycleAssessmentService) => {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
12
|
+
export declare const createLifecycleHandlers: (service: LifecycleAssessmentService) => {
|
|
13
|
+
runAssessment: (req: HttpRequest<LifecycleAssessmentRequest>) => Promise<HttpResponse<LifecycleAssessmentResponse>>;
|
|
14
|
+
getPlaybook: (req: HttpRequest<unknown, {
|
|
15
|
+
stage: string;
|
|
16
|
+
}>) => Promise<HttpResponse>;
|
|
18
17
|
};
|
|
19
|
-
//#endregion
|
|
20
|
-
export { HttpRequest, HttpResponse, createLifecycleHandlers };
|
|
21
18
|
//# sourceMappingURL=rest-handlers.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rest-handlers.d.ts","
|
|
1
|
+
{"version":3,"file":"rest-handlers.d.ts","sourceRoot":"","sources":["../../src/api/rest-handlers.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,0BAA0B,EAC1B,2BAA2B,EAC5B,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,0BAA0B,EAAE,MAAM,gCAAgC,CAAC;AAE5E,MAAM,WAAW,WAAW,CAC1B,KAAK,GAAG,OAAO,EACf,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;IAEhC,IAAI,CAAC,EAAE,KAAK,CAAC;IACb,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC;CAC5C;AAED,MAAM,WAAW,YAAY,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IACvD,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,CAAC,CAAC;CACT;AAED,eAAO,MAAM,uBAAuB,GAClC,SAAS,0BAA0B;yBAG5B,WAAW,CAAC,0BAA0B,CAAC,KAC3C,OAAO,CAAC,YAAY,CAAC,2BAA2B,CAAC,CAAC;uBAM9C,WAAW,CAAC,OAAO,EAAE;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,KAC3C,OAAO,CAAC,YAAY,CAAC;CAKxB,CAAC"}
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
// src/services/assessment-service.ts
|
|
2
|
+
import {
|
|
3
|
+
ProductPhase,
|
|
4
|
+
CompanyPhase,
|
|
5
|
+
CapitalPhase
|
|
6
|
+
} from "@contractspec/lib.lifecycle";
|
|
7
|
+
import {
|
|
8
|
+
LifecycleOrchestrator,
|
|
9
|
+
StageSignalCollector,
|
|
10
|
+
StageScorer,
|
|
11
|
+
LifecycleMilestonePlanner
|
|
12
|
+
} from "@contractspec/module.lifecycle-core";
|
|
13
|
+
import {
|
|
14
|
+
LifecycleRecommendationEngine,
|
|
15
|
+
ContractSpecLibraryRecommender,
|
|
16
|
+
LifecycleCeremonyDesigner
|
|
17
|
+
} from "@contractspec/module.lifecycle-advisor";
|
|
18
|
+
import {
|
|
19
|
+
LifecycleKpiPipeline
|
|
20
|
+
} from "@contractspec/lib.observability";
|
|
21
|
+
|
|
22
|
+
class LifecycleAssessmentService {
|
|
23
|
+
orchestrator;
|
|
24
|
+
recommendationEngine;
|
|
25
|
+
libraryRecommender;
|
|
26
|
+
ceremonyDesigner;
|
|
27
|
+
pipeline;
|
|
28
|
+
eventBridge;
|
|
29
|
+
constructor(options) {
|
|
30
|
+
const collector = new StageSignalCollector(options.collector);
|
|
31
|
+
const scorer = new StageScorer;
|
|
32
|
+
const milestonePlanner = new LifecycleMilestonePlanner;
|
|
33
|
+
this.orchestrator = new LifecycleOrchestrator({
|
|
34
|
+
collector,
|
|
35
|
+
scorer,
|
|
36
|
+
milestonePlanner
|
|
37
|
+
});
|
|
38
|
+
this.recommendationEngine = options.recommendationEngine ?? new LifecycleRecommendationEngine;
|
|
39
|
+
this.libraryRecommender = options.libraryRecommender ?? new ContractSpecLibraryRecommender;
|
|
40
|
+
this.ceremonyDesigner = options.ceremonyDesigner ?? new LifecycleCeremonyDesigner;
|
|
41
|
+
this.pipeline = options.pipeline ?? new LifecycleKpiPipeline;
|
|
42
|
+
this.eventBridge = options.eventBridge;
|
|
43
|
+
if (options.onPipelineEvent) {
|
|
44
|
+
this.pipeline.on(options.onPipelineEvent);
|
|
45
|
+
}
|
|
46
|
+
if (this.eventBridge) {
|
|
47
|
+
this.pipeline.on((event) => this.eventBridge?.forward(event));
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
async runAssessment(request) {
|
|
51
|
+
const assessment = await this.orchestrator.run(request);
|
|
52
|
+
const upcoming = this.orchestrator.getUpcomingMilestones(assessment.stage, request.completedMilestones);
|
|
53
|
+
this.pipeline.recordAssessment(assessment, request.tenantId);
|
|
54
|
+
const recommendation = this.recommendationEngine.generate(assessment, {
|
|
55
|
+
upcomingMilestones: upcoming
|
|
56
|
+
});
|
|
57
|
+
const libraries = this.libraryRecommender.recommend(assessment.stage);
|
|
58
|
+
const ceremony = this.ceremonyDesigner.design(assessment.stage);
|
|
59
|
+
return {
|
|
60
|
+
assessment,
|
|
61
|
+
recommendation,
|
|
62
|
+
libraries,
|
|
63
|
+
ceremony
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
getStagePlaybook(stage) {
|
|
67
|
+
const recommendation = this.recommendationEngine.generate({
|
|
68
|
+
stage,
|
|
69
|
+
confidence: 1,
|
|
70
|
+
axes: {
|
|
71
|
+
product: ProductPhase.Mvp,
|
|
72
|
+
company: CompanyPhase.TinyTeam,
|
|
73
|
+
capital: CapitalPhase.Seed
|
|
74
|
+
},
|
|
75
|
+
signals: [],
|
|
76
|
+
gaps: [],
|
|
77
|
+
focusAreas: [],
|
|
78
|
+
scorecard: [],
|
|
79
|
+
generatedAt: new Date().toISOString()
|
|
80
|
+
}, { upcomingMilestones: this.orchestrator.getUpcomingMilestones(stage) });
|
|
81
|
+
return {
|
|
82
|
+
recommendation,
|
|
83
|
+
libraries: this.libraryRecommender.recommend(stage),
|
|
84
|
+
ceremony: this.ceremonyDesigner.design(stage)
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
// src/events/lifecycle-events.ts
|
|
89
|
+
import { lifecycleEventNames } from "@contractspec/lib.analytics";
|
|
90
|
+
|
|
91
|
+
class LifecycleEventBridge {
|
|
92
|
+
publisher;
|
|
93
|
+
constructor(publisher) {
|
|
94
|
+
this.publisher = publisher;
|
|
95
|
+
}
|
|
96
|
+
forward(event) {
|
|
97
|
+
if (!this.publisher)
|
|
98
|
+
return;
|
|
99
|
+
switch (event.type) {
|
|
100
|
+
case "assessment.recorded":
|
|
101
|
+
this.publisher({
|
|
102
|
+
name: lifecycleEventNames.assessmentRun,
|
|
103
|
+
properties: {
|
|
104
|
+
tenantId: event.payload.tenantId,
|
|
105
|
+
stage: event.payload.stage
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
break;
|
|
109
|
+
case "stage.changed":
|
|
110
|
+
this.publisher({
|
|
111
|
+
name: lifecycleEventNames.stageChanged,
|
|
112
|
+
properties: {
|
|
113
|
+
tenantId: event.payload.tenantId,
|
|
114
|
+
previousStage: event.payload.previousStage,
|
|
115
|
+
nextStage: event.payload.nextStage
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
break;
|
|
119
|
+
case "confidence.low":
|
|
120
|
+
this.publisher({
|
|
121
|
+
name: `${lifecycleEventNames.assessmentRun}.low_confidence`,
|
|
122
|
+
properties: {
|
|
123
|
+
tenantId: event.payload.tenantId,
|
|
124
|
+
confidence: event.payload.confidence
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
break;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
// src/agents/lifecycle-advisor-agent.ts
|
|
132
|
+
import { defineAgent } from "@contractspec/lib.ai-agent";
|
|
133
|
+
var LifecycleAdvisorAgent = defineAgent({
|
|
134
|
+
meta: {
|
|
135
|
+
key: "lifecycle.advisor",
|
|
136
|
+
version: "1.0.0",
|
|
137
|
+
title: "Lifecycle Advisor Agent",
|
|
138
|
+
description: "Guides artisans through lifecycle detection, focus areas, and ceremonies.",
|
|
139
|
+
owners: ["team-lifecycle"],
|
|
140
|
+
domain: "operations",
|
|
141
|
+
tags: ["guide", "lifecycle", "ops"],
|
|
142
|
+
stability: "experimental"
|
|
143
|
+
},
|
|
144
|
+
description: "Guides users through lifecycle assessments, highlights gaps, and recommends actions tied to ContractSpec libraries.",
|
|
145
|
+
instructions: `You are the Lifecycle Advisor. Always clarify the user's current stage, confidence, and blockers before suggesting actions.
|
|
146
|
+
- Prioritize simple, mobile-friendly instructions.
|
|
147
|
+
- When in early stages, focus on learning loops, not heavy infra.
|
|
148
|
+
- When in later stages, emphasize repeatability, telemetry, and managed ceremonies.
|
|
149
|
+
- Suggest at most 3 actions at a time. Reference ContractSpec libraries or modules when relevant.`,
|
|
150
|
+
tools: [
|
|
151
|
+
{
|
|
152
|
+
name: "run_assessment",
|
|
153
|
+
description: "Trigger a lifecycle assessment for a tenant.",
|
|
154
|
+
schema: {
|
|
155
|
+
type: "object",
|
|
156
|
+
properties: {
|
|
157
|
+
tenantId: { type: "string" },
|
|
158
|
+
questionnaire: { type: "object", additionalProperties: true }
|
|
159
|
+
},
|
|
160
|
+
required: ["tenantId"]
|
|
161
|
+
},
|
|
162
|
+
automationSafe: true
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
name: "fetch_playbook",
|
|
166
|
+
description: "Retrieve stage-specific playbook (actions, ceremonies, libraries).",
|
|
167
|
+
schema: {
|
|
168
|
+
type: "object",
|
|
169
|
+
properties: {
|
|
170
|
+
stage: {
|
|
171
|
+
type: "integer",
|
|
172
|
+
minimum: 0,
|
|
173
|
+
maximum: 6,
|
|
174
|
+
description: "Lifecycle stage number (0-6)"
|
|
175
|
+
}
|
|
176
|
+
},
|
|
177
|
+
required: ["stage"]
|
|
178
|
+
},
|
|
179
|
+
automationSafe: true
|
|
180
|
+
}
|
|
181
|
+
],
|
|
182
|
+
memory: {
|
|
183
|
+
maxEntries: 25,
|
|
184
|
+
ttlMinutes: 120
|
|
185
|
+
},
|
|
186
|
+
policy: {
|
|
187
|
+
confidence: { min: 0.7 },
|
|
188
|
+
escalation: {
|
|
189
|
+
confidenceThreshold: 0.5,
|
|
190
|
+
approvalWorkflow: "ops.lifecycle.escalation"
|
|
191
|
+
},
|
|
192
|
+
flags: ["lifecycle_advisor"]
|
|
193
|
+
}
|
|
194
|
+
});
|
|
195
|
+
// src/api/rest-handlers.ts
|
|
196
|
+
var createLifecycleHandlers = (service) => ({
|
|
197
|
+
runAssessment: async (req) => {
|
|
198
|
+
const payload = req.body ?? {};
|
|
199
|
+
const result = await service.runAssessment(payload);
|
|
200
|
+
return { status: 200, body: result };
|
|
201
|
+
},
|
|
202
|
+
getPlaybook: async (req) => {
|
|
203
|
+
const stage = Number(req.params?.stage ?? 0);
|
|
204
|
+
const result = service.getStagePlaybook(stage);
|
|
205
|
+
return { status: 200, body: result };
|
|
206
|
+
}
|
|
207
|
+
});
|
|
208
|
+
export {
|
|
209
|
+
createLifecycleHandlers,
|
|
210
|
+
LifecycleEventBridge,
|
|
211
|
+
LifecycleAssessmentService,
|
|
212
|
+
LifecycleAdvisorAgent
|
|
213
|
+
};
|
|
@@ -1,16 +1,12 @@
|
|
|
1
|
-
import { LifecyclePipelineEvent } from
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
name: string;
|
|
6
|
-
properties: Record<string, unknown>;
|
|
1
|
+
import type { LifecyclePipelineEvent } from '@contractspec/lib.observability';
|
|
2
|
+
export interface ManagedLifecycleEvent {
|
|
3
|
+
name: string;
|
|
4
|
+
properties: Record<string, unknown>;
|
|
7
5
|
}
|
|
8
|
-
type LifecycleEventPublisher = (event: ManagedLifecycleEvent) => Promise<void> | void;
|
|
9
|
-
declare class LifecycleEventBridge {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
6
|
+
export type LifecycleEventPublisher = (event: ManagedLifecycleEvent) => Promise<void> | void;
|
|
7
|
+
export declare class LifecycleEventBridge {
|
|
8
|
+
private readonly publisher?;
|
|
9
|
+
constructor(publisher?: LifecycleEventPublisher | undefined);
|
|
10
|
+
forward(event: LifecyclePipelineEvent): void;
|
|
13
11
|
}
|
|
14
|
-
//#endregion
|
|
15
|
-
export { LifecycleEventBridge, LifecycleEventPublisher, ManagedLifecycleEvent };
|
|
16
12
|
//# sourceMappingURL=lifecycle-events.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lifecycle-events.d.ts","
|
|
1
|
+
{"version":3,"file":"lifecycle-events.d.ts","sourceRoot":"","sources":["../../src/events/lifecycle-events.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AAG9E,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACrC;AAED,MAAM,MAAM,uBAAuB,GAAG,CACpC,KAAK,EAAE,qBAAqB,KACzB,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;AAE1B,qBAAa,oBAAoB;IACnB,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC;gBAAV,SAAS,CAAC,EAAE,uBAAuB,YAAA;IAEhE,OAAO,CAAC,KAAK,EAAE,sBAAsB;CAiCtC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
export * from './services/assessment-service';
|
|
2
|
+
export * from './events/lifecycle-events';
|
|
3
|
+
export * from './agents/lifecycle-advisor-agent';
|
|
4
|
+
export * from './api/rest-handlers';
|
|
5
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,+BAA+B,CAAC;AAC9C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,kCAAkC,CAAC;AACjD,cAAc,qBAAqB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,214 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
|
|
1
|
+
// @bun
|
|
2
|
+
// src/services/assessment-service.ts
|
|
3
|
+
import {
|
|
4
|
+
ProductPhase,
|
|
5
|
+
CompanyPhase,
|
|
6
|
+
CapitalPhase
|
|
7
|
+
} from "@contractspec/lib.lifecycle";
|
|
8
|
+
import {
|
|
9
|
+
LifecycleOrchestrator,
|
|
10
|
+
StageSignalCollector,
|
|
11
|
+
StageScorer,
|
|
12
|
+
LifecycleMilestonePlanner
|
|
13
|
+
} from "@contractspec/module.lifecycle-core";
|
|
14
|
+
import {
|
|
15
|
+
LifecycleRecommendationEngine,
|
|
16
|
+
ContractSpecLibraryRecommender,
|
|
17
|
+
LifecycleCeremonyDesigner
|
|
18
|
+
} from "@contractspec/module.lifecycle-advisor";
|
|
19
|
+
import {
|
|
20
|
+
LifecycleKpiPipeline
|
|
21
|
+
} from "@contractspec/lib.observability";
|
|
5
22
|
|
|
6
|
-
|
|
23
|
+
class LifecycleAssessmentService {
|
|
24
|
+
orchestrator;
|
|
25
|
+
recommendationEngine;
|
|
26
|
+
libraryRecommender;
|
|
27
|
+
ceremonyDesigner;
|
|
28
|
+
pipeline;
|
|
29
|
+
eventBridge;
|
|
30
|
+
constructor(options) {
|
|
31
|
+
const collector = new StageSignalCollector(options.collector);
|
|
32
|
+
const scorer = new StageScorer;
|
|
33
|
+
const milestonePlanner = new LifecycleMilestonePlanner;
|
|
34
|
+
this.orchestrator = new LifecycleOrchestrator({
|
|
35
|
+
collector,
|
|
36
|
+
scorer,
|
|
37
|
+
milestonePlanner
|
|
38
|
+
});
|
|
39
|
+
this.recommendationEngine = options.recommendationEngine ?? new LifecycleRecommendationEngine;
|
|
40
|
+
this.libraryRecommender = options.libraryRecommender ?? new ContractSpecLibraryRecommender;
|
|
41
|
+
this.ceremonyDesigner = options.ceremonyDesigner ?? new LifecycleCeremonyDesigner;
|
|
42
|
+
this.pipeline = options.pipeline ?? new LifecycleKpiPipeline;
|
|
43
|
+
this.eventBridge = options.eventBridge;
|
|
44
|
+
if (options.onPipelineEvent) {
|
|
45
|
+
this.pipeline.on(options.onPipelineEvent);
|
|
46
|
+
}
|
|
47
|
+
if (this.eventBridge) {
|
|
48
|
+
this.pipeline.on((event) => this.eventBridge?.forward(event));
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
async runAssessment(request) {
|
|
52
|
+
const assessment = await this.orchestrator.run(request);
|
|
53
|
+
const upcoming = this.orchestrator.getUpcomingMilestones(assessment.stage, request.completedMilestones);
|
|
54
|
+
this.pipeline.recordAssessment(assessment, request.tenantId);
|
|
55
|
+
const recommendation = this.recommendationEngine.generate(assessment, {
|
|
56
|
+
upcomingMilestones: upcoming
|
|
57
|
+
});
|
|
58
|
+
const libraries = this.libraryRecommender.recommend(assessment.stage);
|
|
59
|
+
const ceremony = this.ceremonyDesigner.design(assessment.stage);
|
|
60
|
+
return {
|
|
61
|
+
assessment,
|
|
62
|
+
recommendation,
|
|
63
|
+
libraries,
|
|
64
|
+
ceremony
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
getStagePlaybook(stage) {
|
|
68
|
+
const recommendation = this.recommendationEngine.generate({
|
|
69
|
+
stage,
|
|
70
|
+
confidence: 1,
|
|
71
|
+
axes: {
|
|
72
|
+
product: ProductPhase.Mvp,
|
|
73
|
+
company: CompanyPhase.TinyTeam,
|
|
74
|
+
capital: CapitalPhase.Seed
|
|
75
|
+
},
|
|
76
|
+
signals: [],
|
|
77
|
+
gaps: [],
|
|
78
|
+
focusAreas: [],
|
|
79
|
+
scorecard: [],
|
|
80
|
+
generatedAt: new Date().toISOString()
|
|
81
|
+
}, { upcomingMilestones: this.orchestrator.getUpcomingMilestones(stage) });
|
|
82
|
+
return {
|
|
83
|
+
recommendation,
|
|
84
|
+
libraries: this.libraryRecommender.recommend(stage),
|
|
85
|
+
ceremony: this.ceremonyDesigner.design(stage)
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
// src/events/lifecycle-events.ts
|
|
90
|
+
import { lifecycleEventNames } from "@contractspec/lib.analytics";
|
|
91
|
+
|
|
92
|
+
class LifecycleEventBridge {
|
|
93
|
+
publisher;
|
|
94
|
+
constructor(publisher) {
|
|
95
|
+
this.publisher = publisher;
|
|
96
|
+
}
|
|
97
|
+
forward(event) {
|
|
98
|
+
if (!this.publisher)
|
|
99
|
+
return;
|
|
100
|
+
switch (event.type) {
|
|
101
|
+
case "assessment.recorded":
|
|
102
|
+
this.publisher({
|
|
103
|
+
name: lifecycleEventNames.assessmentRun,
|
|
104
|
+
properties: {
|
|
105
|
+
tenantId: event.payload.tenantId,
|
|
106
|
+
stage: event.payload.stage
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
break;
|
|
110
|
+
case "stage.changed":
|
|
111
|
+
this.publisher({
|
|
112
|
+
name: lifecycleEventNames.stageChanged,
|
|
113
|
+
properties: {
|
|
114
|
+
tenantId: event.payload.tenantId,
|
|
115
|
+
previousStage: event.payload.previousStage,
|
|
116
|
+
nextStage: event.payload.nextStage
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
break;
|
|
120
|
+
case "confidence.low":
|
|
121
|
+
this.publisher({
|
|
122
|
+
name: `${lifecycleEventNames.assessmentRun}.low_confidence`,
|
|
123
|
+
properties: {
|
|
124
|
+
tenantId: event.payload.tenantId,
|
|
125
|
+
confidence: event.payload.confidence
|
|
126
|
+
}
|
|
127
|
+
});
|
|
128
|
+
break;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
// src/agents/lifecycle-advisor-agent.ts
|
|
133
|
+
import { defineAgent } from "@contractspec/lib.ai-agent";
|
|
134
|
+
var LifecycleAdvisorAgent = defineAgent({
|
|
135
|
+
meta: {
|
|
136
|
+
key: "lifecycle.advisor",
|
|
137
|
+
version: "1.0.0",
|
|
138
|
+
title: "Lifecycle Advisor Agent",
|
|
139
|
+
description: "Guides artisans through lifecycle detection, focus areas, and ceremonies.",
|
|
140
|
+
owners: ["team-lifecycle"],
|
|
141
|
+
domain: "operations",
|
|
142
|
+
tags: ["guide", "lifecycle", "ops"],
|
|
143
|
+
stability: "experimental"
|
|
144
|
+
},
|
|
145
|
+
description: "Guides users through lifecycle assessments, highlights gaps, and recommends actions tied to ContractSpec libraries.",
|
|
146
|
+
instructions: `You are the Lifecycle Advisor. Always clarify the user's current stage, confidence, and blockers before suggesting actions.
|
|
147
|
+
- Prioritize simple, mobile-friendly instructions.
|
|
148
|
+
- When in early stages, focus on learning loops, not heavy infra.
|
|
149
|
+
- When in later stages, emphasize repeatability, telemetry, and managed ceremonies.
|
|
150
|
+
- Suggest at most 3 actions at a time. Reference ContractSpec libraries or modules when relevant.`,
|
|
151
|
+
tools: [
|
|
152
|
+
{
|
|
153
|
+
name: "run_assessment",
|
|
154
|
+
description: "Trigger a lifecycle assessment for a tenant.",
|
|
155
|
+
schema: {
|
|
156
|
+
type: "object",
|
|
157
|
+
properties: {
|
|
158
|
+
tenantId: { type: "string" },
|
|
159
|
+
questionnaire: { type: "object", additionalProperties: true }
|
|
160
|
+
},
|
|
161
|
+
required: ["tenantId"]
|
|
162
|
+
},
|
|
163
|
+
automationSafe: true
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
name: "fetch_playbook",
|
|
167
|
+
description: "Retrieve stage-specific playbook (actions, ceremonies, libraries).",
|
|
168
|
+
schema: {
|
|
169
|
+
type: "object",
|
|
170
|
+
properties: {
|
|
171
|
+
stage: {
|
|
172
|
+
type: "integer",
|
|
173
|
+
minimum: 0,
|
|
174
|
+
maximum: 6,
|
|
175
|
+
description: "Lifecycle stage number (0-6)"
|
|
176
|
+
}
|
|
177
|
+
},
|
|
178
|
+
required: ["stage"]
|
|
179
|
+
},
|
|
180
|
+
automationSafe: true
|
|
181
|
+
}
|
|
182
|
+
],
|
|
183
|
+
memory: {
|
|
184
|
+
maxEntries: 25,
|
|
185
|
+
ttlMinutes: 120
|
|
186
|
+
},
|
|
187
|
+
policy: {
|
|
188
|
+
confidence: { min: 0.7 },
|
|
189
|
+
escalation: {
|
|
190
|
+
confidenceThreshold: 0.5,
|
|
191
|
+
approvalWorkflow: "ops.lifecycle.escalation"
|
|
192
|
+
},
|
|
193
|
+
flags: ["lifecycle_advisor"]
|
|
194
|
+
}
|
|
195
|
+
});
|
|
196
|
+
// src/api/rest-handlers.ts
|
|
197
|
+
var createLifecycleHandlers = (service) => ({
|
|
198
|
+
runAssessment: async (req) => {
|
|
199
|
+
const payload = req.body ?? {};
|
|
200
|
+
const result = await service.runAssessment(payload);
|
|
201
|
+
return { status: 200, body: result };
|
|
202
|
+
},
|
|
203
|
+
getPlaybook: async (req) => {
|
|
204
|
+
const stage = Number(req.params?.stage ?? 0);
|
|
205
|
+
const result = service.getStagePlaybook(stage);
|
|
206
|
+
return { status: 200, body: result };
|
|
207
|
+
}
|
|
208
|
+
});
|
|
209
|
+
export {
|
|
210
|
+
createLifecycleHandlers,
|
|
211
|
+
LifecycleEventBridge,
|
|
212
|
+
LifecycleAssessmentService,
|
|
213
|
+
LifecycleAdvisorAgent
|
|
214
|
+
};
|