@gaia-ai/core 0.4.1 → 0.4.3
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.
|
@@ -1,19 +1,6 @@
|
|
|
1
1
|
import type { JsonApiClient } from 'dropsh/plugin';
|
|
2
2
|
import type { RemotePlugin } from '../plugins.js';
|
|
3
|
-
import type { ActiveRun, ClaimedRun, ClaimOptions, ConductorRegistration, ConductorStatus, FinalizableRun, GaiaRemote, RunWriteAttributes, Ticket,
|
|
4
|
-
interface JsonApiResource {
|
|
5
|
-
type?: string;
|
|
6
|
-
id?: string;
|
|
7
|
-
attributes?: Record<string, unknown>;
|
|
8
|
-
}
|
|
9
|
-
/**
|
|
10
|
-
* Extracts gaia_comment resources from a JSON:API `included` array into
|
|
11
|
-
* conductor-facing TicketComments. JSON:API renames the comment entity's `type`
|
|
12
|
-
* field to `gaia_comment_type` (the bare `type` is the reserved resource type),
|
|
13
|
-
* and serialises the text_long `body` as `{value, format, processed}`. Resources
|
|
14
|
-
* of other types are ignored; the server already returns them created-ASC.
|
|
15
|
-
*/
|
|
16
|
-
export declare function parseTicketComments(included: JsonApiResource[] | undefined): TicketComment[];
|
|
3
|
+
import type { ActiveRun, ClaimedRun, ClaimOptions, ConductorRegistration, ConductorStatus, FinalizableRun, GaiaRemote, RunWriteAttributes, Ticket, UncleanTicket } from './remote.js';
|
|
17
4
|
export declare class DrupalGaiaRemote implements GaiaRemote {
|
|
18
5
|
private readonly api;
|
|
19
6
|
constructor(api: JsonApiClient);
|
|
@@ -45,4 +32,3 @@ export declare class DrupalGaiaRemote implements GaiaRemote {
|
|
|
45
32
|
private projectUuid;
|
|
46
33
|
}
|
|
47
34
|
export declare function drupalRemote(): RemotePlugin;
|
|
48
|
-
export {};
|
|
@@ -1,39 +1,6 @@
|
|
|
1
1
|
import { resolveAuth } from 'dropsh';
|
|
2
2
|
import { createHttpClient, createJsonApiClient } from 'dropsh/plugin';
|
|
3
3
|
const ACTIVE = ['claimed', 'running'];
|
|
4
|
-
/**
|
|
5
|
-
* Extracts gaia_comment resources from a JSON:API `included` array into
|
|
6
|
-
* conductor-facing TicketComments. JSON:API renames the comment entity's `type`
|
|
7
|
-
* field to `gaia_comment_type` (the bare `type` is the reserved resource type),
|
|
8
|
-
* and serialises the text_long `body` as `{value, format, processed}`. Resources
|
|
9
|
-
* of other types are ignored; the server already returns them created-ASC.
|
|
10
|
-
*/
|
|
11
|
-
export function parseTicketComments(included) {
|
|
12
|
-
if (!Array.isArray(included)) {
|
|
13
|
-
return [];
|
|
14
|
-
}
|
|
15
|
-
const comments = [];
|
|
16
|
-
for (const res of included) {
|
|
17
|
-
if (res?.type !== 'gaia_comment--gaia_comment') {
|
|
18
|
-
continue;
|
|
19
|
-
}
|
|
20
|
-
const attrs = res.attributes ?? {};
|
|
21
|
-
const body = attrs.body;
|
|
22
|
-
const value = typeof body === 'string'
|
|
23
|
-
? body
|
|
24
|
-
: typeof body?.value === 'string'
|
|
25
|
-
? body.value
|
|
26
|
-
: '';
|
|
27
|
-
comments.push({
|
|
28
|
-
type: typeof attrs.gaia_comment_type === 'string'
|
|
29
|
-
? attrs.gaia_comment_type
|
|
30
|
-
: 'comment',
|
|
31
|
-
body: value,
|
|
32
|
-
created: typeof attrs.created === 'string' ? attrs.created : '',
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
return comments;
|
|
36
|
-
}
|
|
37
4
|
export class DrupalGaiaRemote {
|
|
38
5
|
api;
|
|
39
6
|
constructor(api) {
|
|
@@ -100,13 +67,10 @@ export class DrupalGaiaRemote {
|
|
|
100
67
|
};
|
|
101
68
|
}
|
|
102
69
|
async getTicket(uuid) {
|
|
103
|
-
//
|
|
104
|
-
//
|
|
105
|
-
//
|
|
106
|
-
|
|
107
|
-
// included resources arrive oldest-first. We use the raw client here rather
|
|
108
|
-
// than `resource()` because `resource()` discards the `included` array.
|
|
109
|
-
const doc = (await this.api.get(`gaia_ticket/gaia_ticket/${uuid}?include=comments`));
|
|
70
|
+
// The agent self-reads the ticket + its comments at run start (GAIA-112),
|
|
71
|
+
// so getTicket only needs the ticket's own attributes for dispatch — no
|
|
72
|
+
// ?include=comments sideload.
|
|
73
|
+
const doc = (await this.api.get(`gaia_ticket/gaia_ticket/${uuid}`));
|
|
110
74
|
const attrs = doc.data?.attributes ?? {};
|
|
111
75
|
const issueUrl = typeof attrs.origin === 'string' ? attrs.origin : undefined;
|
|
112
76
|
return {
|
|
@@ -122,7 +86,6 @@ export class DrupalGaiaRemote {
|
|
|
122
86
|
attrs.effective_env_vars !== ''
|
|
123
87
|
? { effectiveEnvVars: attrs.effective_env_vars }
|
|
124
88
|
: {}),
|
|
125
|
-
comments: parseTicketComments(doc.included),
|
|
126
89
|
...(issueUrl ? { issueUrl } : {}),
|
|
127
90
|
};
|
|
128
91
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { RemotePlugin } from '../plugins.js';
|
|
2
|
-
import type { ActiveRun, ClaimedRun, ClaimOptions, ConductorRegistration, ConductorStatus, FinalizableRun, GaiaRemote, RunWriteAttributes, Ticket,
|
|
2
|
+
import type { ActiveRun, ClaimedRun, ClaimOptions, ConductorRegistration, ConductorStatus, FinalizableRun, GaiaRemote, RunWriteAttributes, Ticket, UncleanTicket } from './remote.js';
|
|
3
3
|
export interface FakeSeedRun {
|
|
4
4
|
runUuid: string;
|
|
5
5
|
/** Numeric (drupal_internal__id) run id. Defaults to a stable 1-based counter when omitted. */
|
|
@@ -23,7 +23,6 @@ export interface FakeSeedTicket {
|
|
|
23
23
|
effectiveEnvVars?: string;
|
|
24
24
|
url?: string;
|
|
25
25
|
workflow?: string;
|
|
26
|
-
comments?: TicketComment[];
|
|
27
26
|
/** Whether the ticket is already closed (its lifecycle wound up). */
|
|
28
27
|
closed?: boolean;
|
|
29
28
|
/** Whether the ticket's worktree is already torn down (cleaned_up flag). */
|
|
@@ -102,7 +102,6 @@ export class FakeGaiaRemote {
|
|
|
102
102
|
branchName,
|
|
103
103
|
...(t.baseBranch ? { baseBranch: t.baseBranch } : {}),
|
|
104
104
|
...(t.effectiveEnvVars ? { effectiveEnvVars: t.effectiveEnvVars } : {}),
|
|
105
|
-
comments: t.comments ?? [],
|
|
106
105
|
...(t.url ? { issueUrl: t.url } : {}),
|
|
107
106
|
};
|
|
108
107
|
}
|
|
@@ -17,15 +17,6 @@ export interface ClaimedRun {
|
|
|
17
17
|
stateAtStart: string;
|
|
18
18
|
handler: string;
|
|
19
19
|
}
|
|
20
|
-
/** A ticket comment, as the conductor injects it into the dispatch prompt. */
|
|
21
|
-
export interface TicketComment {
|
|
22
|
-
/** comment | spec | plan | debug_diagnose | summary | acceptance | test */
|
|
23
|
-
type: string;
|
|
24
|
-
/** Raw body (gaia_rich HTML). */
|
|
25
|
-
body: string;
|
|
26
|
-
/** ISO 8601 creation timestamp. */
|
|
27
|
-
created: string;
|
|
28
|
-
}
|
|
29
20
|
export interface Ticket {
|
|
30
21
|
uuid: string;
|
|
31
22
|
identifier: string;
|
|
@@ -43,13 +34,6 @@ export interface Ticket {
|
|
|
43
34
|
*/
|
|
44
35
|
effectiveEnvVars?: string;
|
|
45
36
|
issueUrl?: string;
|
|
46
|
-
/**
|
|
47
|
-
* Comments on the ticket, oldest first. The conductor renders these into the
|
|
48
|
-
* dispatch prompt so a review→coding bounce carries the review summary to the
|
|
49
|
-
* coder. Empty when the ticket has none — or when the session role lacks
|
|
50
|
-
* `view gaia_comment` (the include degrades to an empty set, never an error).
|
|
51
|
-
*/
|
|
52
|
-
comments: TicketComment[];
|
|
53
37
|
}
|
|
54
38
|
export interface ActiveRun {
|
|
55
39
|
runUuid: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gaia-ai/core",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.3",
|
|
4
4
|
"description": "GAIA global contract: plugin API, built-in remotes/workspaces/auth, shared primitives.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"directory": "conductor/packages/core"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"dropsh": "^0.5.
|
|
29
|
+
"dropsh": "^0.5.3",
|
|
30
30
|
"pino": "^9.6.0",
|
|
31
31
|
"pino-pretty": "^13.0.0"
|
|
32
32
|
}
|