@octo-cyber/ai 0.5.0 → 0.5.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 (83) hide show
  1. package/dist/ai.module.d.ts +1 -1
  2. package/dist/ai.module.d.ts.map +1 -1
  3. package/dist/ai.module.js +1 -1
  4. package/dist/ai.module.js.map +1 -1
  5. package/dist/cli/cli-executor.service.js +1 -1
  6. package/dist/cli/cli-executor.service.js.map +1 -1
  7. package/dist/cli/cli-registry.service.js +1 -1
  8. package/dist/cli/cli-registry.service.js.map +1 -1
  9. package/dist/cli/controllers/ai-cli.controller.d.ts +1 -1
  10. package/dist/cli/controllers/ai-cli.controller.d.ts.map +1 -1
  11. package/dist/cli/controllers/ai-cli.controller.js +1 -1
  12. package/dist/cli/controllers/ai-cli.controller.js.map +1 -1
  13. package/dist/cli/workspace.service.js +1 -1
  14. package/dist/cli/workspace.service.js.map +1 -1
  15. package/package.json +5 -5
  16. package/dist/controllers/agent.controller.d.ts +0 -13
  17. package/dist/controllers/agent.controller.d.ts.map +0 -1
  18. package/dist/controllers/agent.controller.js +0 -117
  19. package/dist/controllers/agent.controller.js.map +0 -1
  20. package/dist/controllers/capability.controller.d.ts +0 -16
  21. package/dist/controllers/capability.controller.d.ts.map +0 -1
  22. package/dist/controllers/capability.controller.js +0 -108
  23. package/dist/controllers/capability.controller.js.map +0 -1
  24. package/dist/controllers/client.controller.d.ts +0 -10
  25. package/dist/controllers/client.controller.d.ts.map +0 -1
  26. package/dist/controllers/client.controller.js +0 -79
  27. package/dist/controllers/client.controller.js.map +0 -1
  28. package/dist/controllers/execution.controller.d.ts +0 -11
  29. package/dist/controllers/execution.controller.d.ts.map +0 -1
  30. package/dist/controllers/execution.controller.js +0 -50
  31. package/dist/controllers/execution.controller.js.map +0 -1
  32. package/dist/controllers/index.d.ts +0 -5
  33. package/dist/controllers/index.d.ts.map +0 -1
  34. package/dist/controllers/index.js +0 -12
  35. package/dist/controllers/index.js.map +0 -1
  36. package/dist/entities/agent-binding.entity.d.ts +0 -17
  37. package/dist/entities/agent-binding.entity.d.ts.map +0 -1
  38. package/dist/entities/agent-binding.entity.js +0 -64
  39. package/dist/entities/agent-binding.entity.js.map +0 -1
  40. package/dist/entities/agent-definition.entity.d.ts +0 -17
  41. package/dist/entities/agent-definition.entity.d.ts.map +0 -1
  42. package/dist/entities/agent-definition.entity.js +0 -70
  43. package/dist/entities/agent-definition.entity.js.map +0 -1
  44. package/dist/entities/agent-execution.entity.d.ts +0 -23
  45. package/dist/entities/agent-execution.entity.d.ts.map +0 -1
  46. package/dist/entities/agent-execution.entity.js +0 -93
  47. package/dist/entities/agent-execution.entity.js.map +0 -1
  48. package/dist/entities/agent-instance.entity.d.ts +0 -19
  49. package/dist/entities/agent-instance.entity.d.ts.map +0 -1
  50. package/dist/entities/agent-instance.entity.js +0 -76
  51. package/dist/entities/agent-instance.entity.js.map +0 -1
  52. package/dist/entities/capability-definition.entity.d.ts +0 -20
  53. package/dist/entities/capability-definition.entity.d.ts.map +0 -1
  54. package/dist/entities/capability-definition.entity.js +0 -77
  55. package/dist/entities/capability-definition.entity.js.map +0 -1
  56. package/dist/entities/client-registration.entity.d.ts +0 -19
  57. package/dist/entities/client-registration.entity.d.ts.map +0 -1
  58. package/dist/entities/client-registration.entity.js +0 -79
  59. package/dist/entities/client-registration.entity.js.map +0 -1
  60. package/dist/entities/index.d.ts +0 -7
  61. package/dist/entities/index.d.ts.map +0 -1
  62. package/dist/entities/index.js +0 -16
  63. package/dist/entities/index.js.map +0 -1
  64. package/dist/services/agent.service.d.ts +0 -23
  65. package/dist/services/agent.service.d.ts.map +0 -1
  66. package/dist/services/agent.service.js +0 -76
  67. package/dist/services/agent.service.js.map +0 -1
  68. package/dist/services/capability-router.service.d.ts +0 -45
  69. package/dist/services/capability-router.service.d.ts.map +0 -1
  70. package/dist/services/capability-router.service.js +0 -120
  71. package/dist/services/capability-router.service.js.map +0 -1
  72. package/dist/services/client-registration.service.d.ts +0 -27
  73. package/dist/services/client-registration.service.d.ts.map +0 -1
  74. package/dist/services/client-registration.service.js +0 -83
  75. package/dist/services/client-registration.service.js.map +0 -1
  76. package/dist/services/index.d.ts +0 -5
  77. package/dist/services/index.d.ts.map +0 -1
  78. package/dist/services/index.js +0 -12
  79. package/dist/services/index.js.map +0 -1
  80. package/dist/services/sync-bridge.service.d.ts +0 -41
  81. package/dist/services/sync-bridge.service.d.ts.map +0 -1
  82. package/dist/services/sync-bridge.service.js +0 -118
  83. package/dist/services/sync-bridge.service.js.map +0 -1
@@ -1,118 +0,0 @@
1
- "use strict";
2
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
- return c > 3 && r && Object.defineProperty(target, key, r), r;
7
- };
8
- Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.SyncBridgeService = void 0;
10
- const core_1 = require("@octo/core");
11
- /**
12
- * Sync Bridge — enables synchronous-style request/response
13
- * communication with asynchronous agent executions.
14
- *
15
- * Pattern: caller sends execution request → waits for completion
16
- * → agent picks up task → completes → bridge resolves the promise.
17
- */
18
- let SyncBridgeService = class SyncBridgeService {
19
- pendingRequests = new Map();
20
- executionRepo;
21
- logger = core_1.Container.get(core_1.LoggerService).child('SyncBridge');
22
- defaultTimeoutMs = 60_000;
23
- setRepository(executionRepo) {
24
- this.executionRepo = executionRepo;
25
- }
26
- /**
27
- * Create an execution and wait for its completion.
28
- * Returns when the agent completes the execution or timeout.
29
- */
30
- async executeAndWait(input, options) {
31
- const execution = this.executionRepo.create({
32
- status: 'PENDING',
33
- input,
34
- instanceId: options?.instanceId ?? null,
35
- capabilityId: options?.capabilityId ?? null,
36
- taskInstanceId: options?.taskInstanceId ?? null,
37
- });
38
- const saved = await this.executionRepo.save(execution);
39
- const bridgeKey = `exec:${saved.id}`;
40
- const timeoutMs = options?.timeoutMs ?? this.defaultTimeoutMs;
41
- return new Promise((resolve, reject) => {
42
- const timer = setTimeout(() => {
43
- this.pendingRequests.delete(bridgeKey);
44
- this.executionRepo.update(saved.id, { status: 'TIMEOUT' }).catch(() => { });
45
- reject(core_1.AppError.conflict(`SyncBridge timeout after ${timeoutMs}ms for execution ${saved.id}`));
46
- }, timeoutMs);
47
- this.pendingRequests.set(bridgeKey, {
48
- resolve,
49
- reject,
50
- timer,
51
- executionId: saved.id,
52
- });
53
- this.logger.debug(`SyncBridge waiting for execution ${saved.id} (timeout: ${timeoutMs}ms)`);
54
- });
55
- }
56
- /**
57
- * Complete an execution — resolves the waiting promise.
58
- * Called by the agent when execution is done.
59
- */
60
- async complete(executionId, output) {
61
- const bridgeKey = `exec:${executionId}`;
62
- const pending = this.pendingRequests.get(bridgeKey);
63
- await this.executionRepo.update(executionId, {
64
- status: 'COMPLETED',
65
- output: output,
66
- completedAt: new Date(),
67
- durationMs: await this.calculateDuration(executionId),
68
- });
69
- if (pending) {
70
- clearTimeout(pending.timer);
71
- this.pendingRequests.delete(bridgeKey);
72
- pending.resolve(output);
73
- this.logger.debug(`SyncBridge resolved execution ${executionId}`);
74
- }
75
- }
76
- /**
77
- * Fail an execution — rejects the waiting promise.
78
- */
79
- async fail(executionId, error) {
80
- const bridgeKey = `exec:${executionId}`;
81
- const pending = this.pendingRequests.get(bridgeKey);
82
- await this.executionRepo.update(executionId, {
83
- status: 'FAILED',
84
- error,
85
- completedAt: new Date(),
86
- durationMs: await this.calculateDuration(executionId),
87
- });
88
- if (pending) {
89
- clearTimeout(pending.timer);
90
- this.pendingRequests.delete(bridgeKey);
91
- pending.reject(new Error(error));
92
- this.logger.debug(`SyncBridge rejected execution ${executionId}: ${error}`);
93
- }
94
- }
95
- /** Get count of pending bridge requests. */
96
- get pendingCount() {
97
- return this.pendingRequests.size;
98
- }
99
- /** Clean up all pending requests on shutdown. */
100
- destroy() {
101
- for (const [key, pending] of this.pendingRequests) {
102
- clearTimeout(pending.timer);
103
- pending.reject(new Error('SyncBridge shutting down'));
104
- this.pendingRequests.delete(key);
105
- }
106
- }
107
- async calculateDuration(executionId) {
108
- const execution = await this.executionRepo.findOne({ where: { id: executionId } });
109
- if (!execution)
110
- return 0;
111
- return Date.now() - execution.createdAt.getTime();
112
- }
113
- };
114
- exports.SyncBridgeService = SyncBridgeService;
115
- exports.SyncBridgeService = SyncBridgeService = __decorate([
116
- (0, core_1.Service)()
117
- ], SyncBridgeService);
118
- //# sourceMappingURL=sync-bridge.service.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"sync-bridge.service.js","sourceRoot":"","sources":["../../src/services/sync-bridge.service.ts"],"names":[],"mappings":";;;;;;;;;AAAA,qCAAyE;AAWzE;;;;;;GAMG;AAEI,IAAM,iBAAiB,GAAvB,MAAM,iBAAiB;IACpB,eAAe,GAAG,IAAI,GAAG,EAA0B,CAAC;IACpD,aAAa,CAA8B;IAC3C,MAAM,GAAG,gBAAS,CAAC,GAAG,CAAC,oBAAa,CAAC,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;IAC1D,gBAAgB,GAAG,MAAM,CAAC;IAElC,aAAa,CAAC,aAAyC;QACrD,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;IACrC,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,cAAc,CAClB,KAA8B,EAC9B,OAKC;QAED,MAAM,SAAS,GAAG,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC;YAC1C,MAAM,EAAE,SAAS;YACjB,KAAK;YACL,UAAU,EAAE,OAAO,EAAE,UAAU,IAAI,IAAI;YACvC,YAAY,EAAE,OAAO,EAAE,YAAY,IAAI,IAAI;YAC3C,cAAc,EAAE,OAAO,EAAE,cAAc,IAAI,IAAI;SAChD,CAAC,CAA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