@ycodium-ai/plugin-team 0.2.5029 → 0.2.5100
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/assets/ui.js +4 -22
- package/dist/index.js +614 -486
- package/package.json +5 -4
package/dist/index.js
CHANGED
|
@@ -8,7 +8,7 @@ var __export = (target, all3) => {
|
|
|
8
8
|
import { definePlugin } from "@ycodium-ai/plugin-api";
|
|
9
9
|
|
|
10
10
|
// ../../packages/plugin-api/src/version.ts
|
|
11
|
-
var PLUGIN_API_VERSION =
|
|
11
|
+
var PLUGIN_API_VERSION = 148;
|
|
12
12
|
|
|
13
13
|
// ../../node_modules/.pnpm/effect@4.0.0-beta.103_patch_hash=2379c0b6f6365efdc960ef467ae589e40827f36fbfe7992e14580cecfa87fd2b/node_modules/effect/dist/Pipeable.js
|
|
14
14
|
var pipeArguments = (self, args2) => {
|
|
@@ -7628,6 +7628,324 @@ var ReadBoardInput = Struct({
|
|
|
7628
7628
|
workLineId: optionalKey2(String4)
|
|
7629
7629
|
});
|
|
7630
7630
|
|
|
7631
|
+
// src/domain/execution.ts
|
|
7632
|
+
function goalExecution(goal) {
|
|
7633
|
+
return {
|
|
7634
|
+
leadMemberId: goal?.leadMemberId ?? null,
|
|
7635
|
+
members: goal === null ? [] : [...goal.threads, ...goal.remoteMembers ?? []]
|
|
7636
|
+
};
|
|
7637
|
+
}
|
|
7638
|
+
function findGoalMember(members, identity2) {
|
|
7639
|
+
return members.find(
|
|
7640
|
+
(member) => "threadId" in identity2 ? "threadId" in member && member.threadId === identity2.threadId : "principalId" in member && member.principalId === identity2.principalId
|
|
7641
|
+
);
|
|
7642
|
+
}
|
|
7643
|
+
|
|
7644
|
+
// src/domain/facts.ts
|
|
7645
|
+
function foldFact(state, event, decode4, keyOf2) {
|
|
7646
|
+
if (event.type !== "plugin.event-appended") return state;
|
|
7647
|
+
const decoded = decode4(event.payload);
|
|
7648
|
+
if (isNone2(decoded)) return state;
|
|
7649
|
+
return { ...state, [keyOf2(decoded.value)]: decoded.value };
|
|
7650
|
+
}
|
|
7651
|
+
function readFact(state, key) {
|
|
7652
|
+
return Object.hasOwn(state, key) ? state[key] : null;
|
|
7653
|
+
}
|
|
7654
|
+
function without(rows, key) {
|
|
7655
|
+
if (!Object.hasOwn(rows, key)) return rows;
|
|
7656
|
+
const next = { ...rows };
|
|
7657
|
+
delete next[key];
|
|
7658
|
+
return next;
|
|
7659
|
+
}
|
|
7660
|
+
var factEnvelope = (name, data) => Struct({ pluginId: Literal2("team"), name: Literal2(`team/${name}`), data });
|
|
7661
|
+
var nowIso = map5(now2, formatIso2);
|
|
7662
|
+
var factTime = () => runPromise2(nowIso);
|
|
7663
|
+
|
|
7664
|
+
// src/domain/recipient.ts
|
|
7665
|
+
var recipientOf = (principal) => principal.kind === "agent" && principal.threadId !== void 0 ? { threadId: principal.threadId } : principal.kind === "remote-agent" && principal.principalId !== void 0 ? { principalId: principal.principalId } : void 0;
|
|
7666
|
+
var recipientKey = (who) => "threadId" in who ? `thread:${who.threadId}` : `principal:${who.principalId}`;
|
|
7667
|
+
|
|
7668
|
+
// src/domain/binding.ts
|
|
7669
|
+
var MemberBoundFact = Struct({
|
|
7670
|
+
version: Literal2(1),
|
|
7671
|
+
projectId: String4,
|
|
7672
|
+
memberId: String4,
|
|
7673
|
+
specKey: String4,
|
|
7674
|
+
goalId: String4,
|
|
7675
|
+
threadId: optionalKey2(String4),
|
|
7676
|
+
principalId: optionalKey2(String4),
|
|
7677
|
+
replaces: optionalKey2(String4)
|
|
7678
|
+
}).check(
|
|
7679
|
+
makeFilter2((fact) => fact.threadId === void 0 !== (fact.principalId === void 0))
|
|
7680
|
+
);
|
|
7681
|
+
var MemberBoundEnvelope = factEnvelope("member-bound", MemberBoundFact);
|
|
7682
|
+
var bindingOfFact = (fact) => fact.threadId !== void 0 ? { threadId: fact.threadId } : { principalId: fact.principalId };
|
|
7683
|
+
function bindingsOf(goal) {
|
|
7684
|
+
const bindings = {};
|
|
7685
|
+
for (const member of goalExecution(goal).members)
|
|
7686
|
+
bindings[member.memberId] = "threadId" in member ? { threadId: member.threadId } : { principalId: member.principalId };
|
|
7687
|
+
return bindings;
|
|
7688
|
+
}
|
|
7689
|
+
function withBoundBinding(bindings, fact) {
|
|
7690
|
+
const next = { ...bindings };
|
|
7691
|
+
if (fact.replaces !== void 0) delete next[fact.replaces];
|
|
7692
|
+
next[fact.memberId] = bindingOfFact(fact);
|
|
7693
|
+
return next;
|
|
7694
|
+
}
|
|
7695
|
+
var leadAfterBinding = (leadMemberId, fact) => fact.replaces !== void 0 && leadMemberId === fact.replaces ? fact.memberId : leadMemberId;
|
|
7696
|
+
function withBoundMember(goal, fact) {
|
|
7697
|
+
if (fact.projectId !== goal.projectId || fact.goalId !== goal.goalId) return goal;
|
|
7698
|
+
const { remoteMembers: _before, ...rest } = goal;
|
|
7699
|
+
const superseded = (memberId) => memberId === fact.memberId || memberId === fact.replaces;
|
|
7700
|
+
const threads = goal.threads.filter((row) => !superseded(row.memberId));
|
|
7701
|
+
const remoteMembers = (goal.remoteMembers ?? []).filter((row) => !superseded(row.memberId));
|
|
7702
|
+
const binding = bindingOfFact(fact);
|
|
7703
|
+
const next = "threadId" in binding ? {
|
|
7704
|
+
threads: [...threads, { memberId: fact.memberId, threadId: binding.threadId }],
|
|
7705
|
+
remoteMembers
|
|
7706
|
+
} : {
|
|
7707
|
+
threads,
|
|
7708
|
+
remoteMembers: [
|
|
7709
|
+
...remoteMembers,
|
|
7710
|
+
{ memberId: fact.memberId, principalId: binding.principalId }
|
|
7711
|
+
]
|
|
7712
|
+
};
|
|
7713
|
+
return {
|
|
7714
|
+
...rest,
|
|
7715
|
+
leadMemberId: leadAfterBinding(goal.leadMemberId, fact),
|
|
7716
|
+
threads: next.threads,
|
|
7717
|
+
...next.remoteMembers.length === 0 ? {} : { remoteMembers: next.remoteMembers }
|
|
7718
|
+
};
|
|
7719
|
+
}
|
|
7720
|
+
function targetOf(bindings, assignee, pinned) {
|
|
7721
|
+
if (assignee.kind !== "member") return recipientOf(assignee);
|
|
7722
|
+
const { memberId } = assignee;
|
|
7723
|
+
if (memberId === void 0) return void 0;
|
|
7724
|
+
const fixed = pinned !== void 0 && Object.hasOwn(pinned, memberId) ? pinned[memberId] : void 0;
|
|
7725
|
+
if (fixed !== void 0) return { threadId: fixed };
|
|
7726
|
+
return bindings !== void 0 && Object.hasOwn(bindings, memberId) ? bindings[memberId] : void 0;
|
|
7727
|
+
}
|
|
7728
|
+
function assignedToGoalMember(goal, assignees) {
|
|
7729
|
+
const execution = goalExecution(goal);
|
|
7730
|
+
const members = execution.members.filter((member) => member.memberId !== execution.leadMemberId);
|
|
7731
|
+
const bindings = bindingsOf(goal);
|
|
7732
|
+
return assignees.some((assignee) => {
|
|
7733
|
+
const who = targetOf(bindings, assignee);
|
|
7734
|
+
return who !== void 0 && findGoalMember(members, who) !== void 0;
|
|
7735
|
+
});
|
|
7736
|
+
}
|
|
7737
|
+
|
|
7738
|
+
// src/domain/pause.ts
|
|
7739
|
+
var LinePausedEnvelope = factEnvelope(
|
|
7740
|
+
"line-paused",
|
|
7741
|
+
Struct({
|
|
7742
|
+
version: Literal2(1),
|
|
7743
|
+
status: Literals(["paused", "resumed"]),
|
|
7744
|
+
projectId: String4,
|
|
7745
|
+
workLineId: String4
|
|
7746
|
+
})
|
|
7747
|
+
);
|
|
7748
|
+
var LineMemberPausedEnvelope = factEnvelope(
|
|
7749
|
+
"line-member-paused",
|
|
7750
|
+
Struct({
|
|
7751
|
+
version: Literal2(1),
|
|
7752
|
+
status: Literals(["paused", "resumed"]),
|
|
7753
|
+
projectId: String4,
|
|
7754
|
+
workLineId: String4,
|
|
7755
|
+
memberId: String4
|
|
7756
|
+
})
|
|
7757
|
+
);
|
|
7758
|
+
|
|
7759
|
+
// src/runtime/wakeEvents.ts
|
|
7760
|
+
var MemberWokenFact = Struct({
|
|
7761
|
+
version: Literal2(1),
|
|
7762
|
+
key: String4,
|
|
7763
|
+
projectId: String4,
|
|
7764
|
+
threadId: optionalKey2(String4),
|
|
7765
|
+
principalId: optionalKey2(String4)
|
|
7766
|
+
});
|
|
7767
|
+
var MemberWorktreeFailedFact = Struct({
|
|
7768
|
+
version: Literal2(1),
|
|
7769
|
+
projectId: String4,
|
|
7770
|
+
threadId: String4,
|
|
7771
|
+
reason: String4
|
|
7772
|
+
});
|
|
7773
|
+
var decodeEnvelope = decodeUnknownOption2(
|
|
7774
|
+
Union2([
|
|
7775
|
+
Struct({
|
|
7776
|
+
pluginId: Literal2("team"),
|
|
7777
|
+
name: Literal2("team/goal-started"),
|
|
7778
|
+
data: GoalStartedFact
|
|
7779
|
+
}),
|
|
7780
|
+
Struct({
|
|
7781
|
+
pluginId: Literal2("team"),
|
|
7782
|
+
name: Literal2("team/member-woken"),
|
|
7783
|
+
data: MemberWokenFact
|
|
7784
|
+
}),
|
|
7785
|
+
MemberBoundEnvelope,
|
|
7786
|
+
LinePausedEnvelope,
|
|
7787
|
+
LineMemberPausedEnvelope,
|
|
7788
|
+
Struct({
|
|
7789
|
+
pluginId: Literal2("team"),
|
|
7790
|
+
name: Literal2("team/member-worktree-failed"),
|
|
7791
|
+
data: MemberWorktreeFailedFact
|
|
7792
|
+
}),
|
|
7793
|
+
Struct({
|
|
7794
|
+
pluginId: Literal2("team"),
|
|
7795
|
+
name: Literal2("team/member-worktree-reported"),
|
|
7796
|
+
data: Struct({
|
|
7797
|
+
version: Literal2(1),
|
|
7798
|
+
projectId: String4,
|
|
7799
|
+
threadId: String4
|
|
7800
|
+
})
|
|
7801
|
+
})
|
|
7802
|
+
])
|
|
7803
|
+
);
|
|
7804
|
+
var Principal = Union2([
|
|
7805
|
+
Struct({ kind: Literal2("human") }),
|
|
7806
|
+
Struct({ kind: Literal2("agent"), threadId: String4 }),
|
|
7807
|
+
// `memberId`:发言转来的远端作者、点名带着成员号(见 `asItemComment`);旧评论没有。
|
|
7808
|
+
Struct({
|
|
7809
|
+
kind: Literal2("remote-agent"),
|
|
7810
|
+
principalId: String4,
|
|
7811
|
+
memberId: optionalKey2(String4)
|
|
7812
|
+
}),
|
|
7813
|
+
Struct({ kind: Literal2("member"), memberId: String4 })
|
|
7814
|
+
]);
|
|
7815
|
+
var Actor = Union2([
|
|
7816
|
+
Principal,
|
|
7817
|
+
Struct({ kind: Literal2("plugin"), pluginId: String4 }),
|
|
7818
|
+
Struct({ kind: Literals(["local-cli", "seat", "system"]) })
|
|
7819
|
+
]);
|
|
7820
|
+
var Updater = Struct({
|
|
7821
|
+
kind: String4,
|
|
7822
|
+
threadId: optionalKey2(String4)
|
|
7823
|
+
});
|
|
7824
|
+
var StateRef = Struct({
|
|
7825
|
+
group: String4,
|
|
7826
|
+
stateId: optionalKey2(String4)
|
|
7827
|
+
});
|
|
7828
|
+
var itemFields = { projectId: String4, workItemId: String4 };
|
|
7829
|
+
var lineField = { workLineId: optional(NullOr(String4)) };
|
|
7830
|
+
var relationFields = {
|
|
7831
|
+
...itemFields,
|
|
7832
|
+
relationKind: String4,
|
|
7833
|
+
relatedWorkItemId: String4
|
|
7834
|
+
};
|
|
7835
|
+
var decodeWorkEvent = decodeUnknownOption2(
|
|
7836
|
+
Union2([
|
|
7837
|
+
Struct({
|
|
7838
|
+
type: Literal2("work.item-created"),
|
|
7839
|
+
payload: Struct({
|
|
7840
|
+
...itemFields,
|
|
7841
|
+
sequenceId: Number5,
|
|
7842
|
+
assignees: ArraySchema(Principal),
|
|
7843
|
+
state: StateRef,
|
|
7844
|
+
...lineField
|
|
7845
|
+
})
|
|
7846
|
+
}),
|
|
7847
|
+
Struct({
|
|
7848
|
+
type: Literal2("work.item-updated"),
|
|
7849
|
+
payload: Struct({
|
|
7850
|
+
...itemFields,
|
|
7851
|
+
assignees: optional(ArraySchema(Principal)),
|
|
7852
|
+
state: optional(StateRef),
|
|
7853
|
+
actor: optional(Updater),
|
|
7854
|
+
...lineField
|
|
7855
|
+
})
|
|
7856
|
+
}),
|
|
7857
|
+
Struct({
|
|
7858
|
+
type: Literal2("work.item-claimed"),
|
|
7859
|
+
payload: Struct({
|
|
7860
|
+
...itemFields,
|
|
7861
|
+
assignee: Principal,
|
|
7862
|
+
state: optional(StateRef)
|
|
7863
|
+
})
|
|
7864
|
+
}),
|
|
7865
|
+
Struct({
|
|
7866
|
+
type: Literal2("work.relation-added"),
|
|
7867
|
+
payload: Struct(relationFields)
|
|
7868
|
+
}),
|
|
7869
|
+
Struct({
|
|
7870
|
+
type: Literal2("work.relation-removed"),
|
|
7871
|
+
payload: Struct(relationFields)
|
|
7872
|
+
}),
|
|
7873
|
+
Struct({
|
|
7874
|
+
type: Literal2("work.comment-posted"),
|
|
7875
|
+
payload: Struct({
|
|
7876
|
+
...itemFields,
|
|
7877
|
+
commentId: String4,
|
|
7878
|
+
parentAuthor: optional(Actor),
|
|
7879
|
+
mentions: ArraySchema(Principal),
|
|
7880
|
+
actor: Actor,
|
|
7881
|
+
// 由件上的发言转来(见 `asItemComment`);旧评论事件没有这个键。
|
|
7882
|
+
fromPost: optional(Literal2(true))
|
|
7883
|
+
})
|
|
7884
|
+
})
|
|
7885
|
+
])
|
|
7886
|
+
);
|
|
7887
|
+
var agentThreads = (principals) => [
|
|
7888
|
+
...new Set(principals.flatMap((p) => p.kind === "agent" ? [p.threadId] : []))
|
|
7889
|
+
];
|
|
7890
|
+
var assigneeMembers = (principals) => [
|
|
7891
|
+
...new Set(principals.flatMap((p) => p.kind === "member" ? [p.memberId] : []))
|
|
7892
|
+
];
|
|
7893
|
+
var PostRef = Union2([
|
|
7894
|
+
Struct({ kind: Literal2("thread"), threadId: String4 }),
|
|
7895
|
+
Struct({ kind: Literal2("member"), memberId: String4 }),
|
|
7896
|
+
Struct({
|
|
7897
|
+
kind: Literal2("principal"),
|
|
7898
|
+
principalId: String4,
|
|
7899
|
+
memberId: optionalKey2(String4)
|
|
7900
|
+
}),
|
|
7901
|
+
Struct({ kind: Literal2("person") })
|
|
7902
|
+
]);
|
|
7903
|
+
var decodeItemPost = decodeUnknownOption2(
|
|
7904
|
+
Struct({
|
|
7905
|
+
postId: String4,
|
|
7906
|
+
projectId: String4,
|
|
7907
|
+
anchor: Struct({ kind: Literal2("work-item"), workItemId: String4 }),
|
|
7908
|
+
author: Actor,
|
|
7909
|
+
mentions: optional(ArraySchema(PostRef)),
|
|
7910
|
+
source: optional(Struct({ memberId: optional(String4) }))
|
|
7911
|
+
})
|
|
7912
|
+
);
|
|
7913
|
+
var asItemComment = (event) => {
|
|
7914
|
+
if (event.type !== "communication.post-sent") return event;
|
|
7915
|
+
const post = decodeItemPost(event.payload);
|
|
7916
|
+
if (isNone2(post)) return event;
|
|
7917
|
+
const { postId, projectId, anchor, author, mentions, source } = post.value;
|
|
7918
|
+
const actor = author.kind === "remote-agent" && source?.memberId !== void 0 ? { ...author, memberId: source.memberId } : author;
|
|
7919
|
+
return {
|
|
7920
|
+
...event,
|
|
7921
|
+
type: "work.comment-posted",
|
|
7922
|
+
payload: {
|
|
7923
|
+
projectId,
|
|
7924
|
+
workItemId: anchor.workItemId,
|
|
7925
|
+
commentId: postId,
|
|
7926
|
+
fromPost: true,
|
|
7927
|
+
actor,
|
|
7928
|
+
mentions: (mentions ?? []).flatMap(
|
|
7929
|
+
(ref) => ref.kind === "thread" ? [{ kind: "agent", threadId: ref.threadId }] : ref.kind === "member" ? [{ kind: "member", memberId: ref.memberId }] : ref.kind === "principal" ? [
|
|
7930
|
+
{
|
|
7931
|
+
kind: "remote-agent",
|
|
7932
|
+
principalId: ref.principalId,
|
|
7933
|
+
...ref.memberId === void 0 ? {} : { memberId: ref.memberId }
|
|
7934
|
+
}
|
|
7935
|
+
] : []
|
|
7936
|
+
)
|
|
7937
|
+
}
|
|
7938
|
+
};
|
|
7939
|
+
};
|
|
7940
|
+
var decodeRemovedPost = decodeUnknownOption2(
|
|
7941
|
+
Struct({ postId: String4, projectId: String4 })
|
|
7942
|
+
);
|
|
7943
|
+
var removedPost = (event) => {
|
|
7944
|
+
if (event.type !== "communication.post-withdrawn" && event.type !== "communication.post-deleted")
|
|
7945
|
+
return null;
|
|
7946
|
+
return getOrNull(decodeRemovedPost(event.payload));
|
|
7947
|
+
};
|
|
7948
|
+
|
|
7631
7949
|
// src/watch.ts
|
|
7632
7950
|
var emptyChanges = () => ({ cursor: 0, handbookCursor: 0, membersCursor: 0 });
|
|
7633
7951
|
var decodeRead = decodeUnknownSync(ReadBoardInput);
|
|
@@ -7707,9 +8025,16 @@ function registerTeamWatch(ctx, options) {
|
|
|
7707
8025
|
);
|
|
7708
8026
|
};
|
|
7709
8027
|
const changed = (event, kinds) => invalidate(eventProject(event), kinds, event.sequence);
|
|
7710
|
-
const stops = [
|
|
7711
|
-
|
|
7712
|
-
|
|
8028
|
+
const stops = [
|
|
8029
|
+
...[.../* @__PURE__ */ new Set([...WORK_EVENTS, ...HANDBOOK_EVENTS, ...MEMBER_EVENTS])].map(
|
|
8030
|
+
(type) => ctx.events.onRaw(type, (event) => changed(event, kindsOf(type)))
|
|
8031
|
+
),
|
|
8032
|
+
// 工作项上的发言就是这件上的评论(0112 U6e),同评论敲看板;挂在会话、人身上的发言不敲。
|
|
8033
|
+
ctx.events.onRaw("communication.post-sent", (event) => {
|
|
8034
|
+
const comment = asItemComment(event);
|
|
8035
|
+
if (comment !== event) changed(comment, ["board"]);
|
|
8036
|
+
})
|
|
8037
|
+
];
|
|
7713
8038
|
stops.push(
|
|
7714
8039
|
ctx.events.onRaw("plugin.event-appended", (event) => {
|
|
7715
8040
|
const fact = decodeFact(event.payload);
|
|
@@ -7966,26 +8291,6 @@ function createSerial(closedMessage = "team-serial-closed") {
|
|
|
7966
8291
|
};
|
|
7967
8292
|
}
|
|
7968
8293
|
|
|
7969
|
-
// src/domain/facts.ts
|
|
7970
|
-
function foldFact(state, event, decode4, keyOf2) {
|
|
7971
|
-
if (event.type !== "plugin.event-appended") return state;
|
|
7972
|
-
const decoded = decode4(event.payload);
|
|
7973
|
-
if (isNone2(decoded)) return state;
|
|
7974
|
-
return { ...state, [keyOf2(decoded.value)]: decoded.value };
|
|
7975
|
-
}
|
|
7976
|
-
function readFact(state, key) {
|
|
7977
|
-
return Object.hasOwn(state, key) ? state[key] : null;
|
|
7978
|
-
}
|
|
7979
|
-
function without(rows, key) {
|
|
7980
|
-
if (!Object.hasOwn(rows, key)) return rows;
|
|
7981
|
-
const next = { ...rows };
|
|
7982
|
-
delete next[key];
|
|
7983
|
-
return next;
|
|
7984
|
-
}
|
|
7985
|
-
var factEnvelope = (name, data) => Struct({ pluginId: Literal2("team"), name: Literal2(`team/${name}`), data });
|
|
7986
|
-
var nowIso = map5(now2, formatIso2);
|
|
7987
|
-
var factTime = () => runPromise2(nowIso);
|
|
7988
|
-
|
|
7989
8294
|
// src/domain/service.ts
|
|
7990
8295
|
var HISTORY_LIMIT = 500;
|
|
7991
8296
|
var ACTIVE_LIMIT = 2e3;
|
|
@@ -8413,105 +8718,18 @@ var canonical = (value) => {
|
|
|
8413
8718
|
);
|
|
8414
8719
|
};
|
|
8415
8720
|
var specKeyOf = (spec) => stableHash(
|
|
8416
|
-
JSON.stringify([
|
|
8417
|
-
spec.environmentId ?? null,
|
|
8418
|
-
canonical(spec.modelSelection ?? null),
|
|
8419
|
-
// 第三格原是主体(合一之前按远端主体记的成员才有),留着空位让本机成员的旧键不变。
|
|
8420
|
-
null
|
|
8421
|
-
])
|
|
8422
|
-
);
|
|
8423
|
-
var specOfMember = (member) => ({
|
|
8424
|
-
environmentId: member.agent?.environmentId ?? null,
|
|
8425
|
-
modelSelection: member.agent?.modelSelection ?? null
|
|
8426
|
-
});
|
|
8427
|
-
var trialIdOf = (projectId, memberId, specKey, attempt) => `team-trial:${stableHash(JSON.stringify([projectId, memberId, specKey, attempt]))}`;
|
|
8428
|
-
|
|
8429
|
-
// src/domain/execution.ts
|
|
8430
|
-
function goalExecution(goal) {
|
|
8431
|
-
return {
|
|
8432
|
-
leadMemberId: goal?.leadMemberId ?? null,
|
|
8433
|
-
members: goal === null ? [] : [...goal.threads, ...goal.remoteMembers ?? []]
|
|
8434
|
-
};
|
|
8435
|
-
}
|
|
8436
|
-
function findGoalMember(members, identity2) {
|
|
8437
|
-
return members.find(
|
|
8438
|
-
(member) => "threadId" in identity2 ? "threadId" in member && member.threadId === identity2.threadId : "principalId" in member && member.principalId === identity2.principalId
|
|
8439
|
-
);
|
|
8440
|
-
}
|
|
8441
|
-
|
|
8442
|
-
// src/domain/recipient.ts
|
|
8443
|
-
var recipientOf = (principal) => principal.kind === "agent" && principal.threadId !== void 0 ? { threadId: principal.threadId } : principal.kind === "remote-agent" && principal.principalId !== void 0 ? { principalId: principal.principalId } : void 0;
|
|
8444
|
-
var recipientKey = (who) => "threadId" in who ? `thread:${who.threadId}` : `principal:${who.principalId}`;
|
|
8445
|
-
|
|
8446
|
-
// src/domain/binding.ts
|
|
8447
|
-
var MemberBoundFact = Struct({
|
|
8448
|
-
version: Literal2(1),
|
|
8449
|
-
projectId: String4,
|
|
8450
|
-
memberId: String4,
|
|
8451
|
-
specKey: String4,
|
|
8452
|
-
goalId: String4,
|
|
8453
|
-
threadId: optionalKey2(String4),
|
|
8454
|
-
principalId: optionalKey2(String4),
|
|
8455
|
-
replaces: optionalKey2(String4)
|
|
8456
|
-
}).check(
|
|
8457
|
-
makeFilter2((fact) => fact.threadId === void 0 !== (fact.principalId === void 0))
|
|
8458
|
-
);
|
|
8459
|
-
var MemberBoundEnvelope = factEnvelope("member-bound", MemberBoundFact);
|
|
8460
|
-
var bindingOfFact = (fact) => fact.threadId !== void 0 ? { threadId: fact.threadId } : { principalId: fact.principalId };
|
|
8461
|
-
function bindingsOf(goal) {
|
|
8462
|
-
const bindings = {};
|
|
8463
|
-
for (const member of goalExecution(goal).members)
|
|
8464
|
-
bindings[member.memberId] = "threadId" in member ? { threadId: member.threadId } : { principalId: member.principalId };
|
|
8465
|
-
return bindings;
|
|
8466
|
-
}
|
|
8467
|
-
function withBoundBinding(bindings, fact) {
|
|
8468
|
-
const next = { ...bindings };
|
|
8469
|
-
if (fact.replaces !== void 0) delete next[fact.replaces];
|
|
8470
|
-
next[fact.memberId] = bindingOfFact(fact);
|
|
8471
|
-
return next;
|
|
8472
|
-
}
|
|
8473
|
-
var leadAfterBinding = (leadMemberId, fact) => fact.replaces !== void 0 && leadMemberId === fact.replaces ? fact.memberId : leadMemberId;
|
|
8474
|
-
function withBoundMember(goal, fact) {
|
|
8475
|
-
if (fact.projectId !== goal.projectId || fact.goalId !== goal.goalId) return goal;
|
|
8476
|
-
const { remoteMembers: _before, ...rest } = goal;
|
|
8477
|
-
const superseded = (memberId) => memberId === fact.memberId || memberId === fact.replaces;
|
|
8478
|
-
const threads = goal.threads.filter((row) => !superseded(row.memberId));
|
|
8479
|
-
const remoteMembers = (goal.remoteMembers ?? []).filter((row) => !superseded(row.memberId));
|
|
8480
|
-
const binding = bindingOfFact(fact);
|
|
8481
|
-
const next = "threadId" in binding ? {
|
|
8482
|
-
threads: [...threads, { memberId: fact.memberId, threadId: binding.threadId }],
|
|
8483
|
-
remoteMembers
|
|
8484
|
-
} : {
|
|
8485
|
-
threads,
|
|
8486
|
-
remoteMembers: [
|
|
8487
|
-
...remoteMembers,
|
|
8488
|
-
{ memberId: fact.memberId, principalId: binding.principalId }
|
|
8489
|
-
]
|
|
8490
|
-
};
|
|
8491
|
-
return {
|
|
8492
|
-
...rest,
|
|
8493
|
-
leadMemberId: leadAfterBinding(goal.leadMemberId, fact),
|
|
8494
|
-
threads: next.threads,
|
|
8495
|
-
...next.remoteMembers.length === 0 ? {} : { remoteMembers: next.remoteMembers }
|
|
8496
|
-
};
|
|
8497
|
-
}
|
|
8498
|
-
function targetOf(bindings, assignee, pinned) {
|
|
8499
|
-
if (assignee.kind !== "member") return recipientOf(assignee);
|
|
8500
|
-
const { memberId } = assignee;
|
|
8501
|
-
if (memberId === void 0) return void 0;
|
|
8502
|
-
const fixed = pinned !== void 0 && Object.hasOwn(pinned, memberId) ? pinned[memberId] : void 0;
|
|
8503
|
-
if (fixed !== void 0) return { threadId: fixed };
|
|
8504
|
-
return bindings !== void 0 && Object.hasOwn(bindings, memberId) ? bindings[memberId] : void 0;
|
|
8505
|
-
}
|
|
8506
|
-
function assignedToGoalMember(goal, assignees) {
|
|
8507
|
-
const execution = goalExecution(goal);
|
|
8508
|
-
const members = execution.members.filter((member) => member.memberId !== execution.leadMemberId);
|
|
8509
|
-
const bindings = bindingsOf(goal);
|
|
8510
|
-
return assignees.some((assignee) => {
|
|
8511
|
-
const who = targetOf(bindings, assignee);
|
|
8512
|
-
return who !== void 0 && findGoalMember(members, who) !== void 0;
|
|
8513
|
-
});
|
|
8514
|
-
}
|
|
8721
|
+
JSON.stringify([
|
|
8722
|
+
spec.environmentId ?? null,
|
|
8723
|
+
canonical(spec.modelSelection ?? null),
|
|
8724
|
+
// 第三格原是主体(合一之前按远端主体记的成员才有),留着空位让本机成员的旧键不变。
|
|
8725
|
+
null
|
|
8726
|
+
])
|
|
8727
|
+
);
|
|
8728
|
+
var specOfMember = (member) => ({
|
|
8729
|
+
environmentId: member.agent?.environmentId ?? null,
|
|
8730
|
+
modelSelection: member.agent?.modelSelection ?? null
|
|
8731
|
+
});
|
|
8732
|
+
var trialIdOf = (projectId, memberId, specKey, attempt) => `team-trial:${stableHash(JSON.stringify([projectId, memberId, specKey, attempt]))}`;
|
|
8515
8733
|
|
|
8516
8734
|
// src/domain/defaultModel.ts
|
|
8517
8735
|
var isSelectionUnavailable = isTagged("ProviderSelectionError");
|
|
@@ -9049,11 +9267,11 @@ function handbookMessage(key, release) {
|
|
|
9049
9267
|
var handbookReminder = (release, toLead) => toLead ? handbookMessage("reminder", release) : `${handbookMessage("reminder", release)} ${handbookMessage("memberHold")}`;
|
|
9050
9268
|
|
|
9051
9269
|
// src/domain/leadBrief.ts
|
|
9052
|
-
var PERSON_MESSAGE_RULE = "Send a message to the person only for a product decision you cannot make yourself; put progress, updates and technical problems
|
|
9270
|
+
var PERSON_MESSAGE_RULE = "Send a message to the person only for a product decision you cannot make yourself; put progress, updates and technical problems on the work item with send_message (to: { workItemId }) instead.";
|
|
9053
9271
|
var MEMBER_CHECKS_RULE = "Before you mark an item done, run the checks that this project's rules name for the code you changed, and fix every failure. Do not mark an item done while a check still fails; say in a work item comment what still fails instead.";
|
|
9054
9272
|
var NO_STASH = "Do not use git stash: all worktrees of this repository share one stash stack.";
|
|
9055
9273
|
var MEMBER_NO_STASH_RULE = `${NO_STASH} To try something you can undo, commit to a temporary branch or copy files into an ignored folder inside your own worktree, and delete it before you mark the item done.`;
|
|
9056
|
-
var MEMBER_ASK_BEFORE_OUTSIDE_RULE = "Before you change dependencies or patches, write outside the project root, or fetch code from the network (git clone, downloads),
|
|
9274
|
+
var MEMBER_ASK_BEFORE_OUTSIDE_RULE = "Before you change dependencies or patches, write outside the project root, or fetch code from the network (git clone, downloads), ask your lead on the work item, the way you would when stuck (see below), and wait for an answer.";
|
|
9057
9275
|
var MEMBER_READ_RANGES_RULE = "Read files in ranges: find the place with Grep first, then read only the lines you need; read only the relevant section of a skill file.";
|
|
9058
9276
|
var LEAD_ACCEPT_RULE = `When you check a finished item, run the checks that this project's rules name yourself. Send the item back if its changes touch patches/ or a lockfile, unless the item has a comment from you approving that change. ${NO_STASH} To compare against the base, run the same check in your own working directory on the base branch and compare the error counts; do not stash in the member's worktree.`;
|
|
9059
9277
|
var PROGRESS_CHECKIN_MINUTES = 20;
|
|
@@ -9061,16 +9279,12 @@ var PROGRESS_CHECKIN_LIMIT = 2;
|
|
|
9061
9279
|
var NO_PROGRESS_TURNS = 2;
|
|
9062
9280
|
var NO_PROGRESS_DELAY_MINUTES = 2;
|
|
9063
9281
|
var NO_PROGRESS_DELAY_CAP_MINUTES = 30;
|
|
9064
|
-
var MEMBER_PROGRESS_RULE = `Report as you go: each time a group of tests turns green, a file you changed passes its typecheck, you are about to change approach because you are stuck, or you are about to stop and wait for someone, commit what you have to your own branch (a work-in-progress commit is fine) and post one line of progress and any blocker on the item with
|
|
9282
|
+
var MEMBER_PROGRESS_RULE = `Report as you go: each time a group of tests turns green, a file you changed passes its typecheck, you are about to change approach because you are stuck, or you are about to stop and wait for someone, commit what you have to your own branch (a work-in-progress commit is fine) and post one line of progress and any blocker on the item with send_message (to: { workItemId }). Do not wait until the whole item is done. If an item of yours goes ${PROGRESS_CHECKIN_MINUTES} minutes with no progress from you, the team plugin mentions you on it to ask; answer it the same way.`;
|
|
9065
9283
|
var memberGroupRule = (groupThreadId, leadsGroup = true) => groupThreadId === void 0 ? "" : ` The group is ${leadsGroup ? "your lead's conversation" : "the team's own conversation, which is not your lead's"}. Read older group records with message_list { groupThreadId: "${groupThreadId}" }, and older conversation messages with list_thread_messages { threadId: "${groupThreadId}" }. To answer in the group use send_message with to: { group: { threadId: "${groupThreadId}" } }, mentions for any member your text addresses with @name, and replyTo the record you are answering; a reply on its own wakes nobody, so mention the member you need in the text.`;
|
|
9066
|
-
var memberStuckRule = (
|
|
9067
|
-
const mention = leadThreadId === void 0 ? "" : ` that mentions your lead (mentions: [{ "kind": "agent", "threadId": "${leadThreadId}" }])`;
|
|
9068
|
-
const reply = leadThreadId === void 0 ? "" : " Your lead will reply or change the plan.";
|
|
9069
|
-
return `If the same error still fails after you have tried to fix it twice, stop and post a work item comment with work_post_comment${mention} saying what fails and what you tried.${reply}`;
|
|
9070
|
-
};
|
|
9284
|
+
var memberStuckRule = (lead) => lead === void 0 ? "If the same error still fails after you have tried to fix it twice, stop and post on the item with send_message (to: { workItemId }) saying what fails and what you tried." : `If the same error still fails after you have tried to fix it twice, stop and post on the item with send_message (to: { workItemId }, mentions: [{ "memberId": "${lead.memberId}" }]) saying what fails and what you tried, with @${lead.name} in the text. Your lead will reply or change the plan.`;
|
|
9071
9285
|
var LEAD_STUCK_RULE = "When a member is stuck, answer in that item's comments before you next look in on members: give a concrete direction, split the item, or reassign it. A member is stuck when they mention you because they are stuck, and also when a comment of theirs reports a blocker, such as a test or error they cannot get past, even if it does not mention you. Do not just note it.";
|
|
9072
9286
|
var LEAD_REPEATED_BLOCKER_RULE = "If, when you look in, a blocker a member reported is still there and their branch has no new commit since your last look-in, do not just ask for a work-in-progress commit: ask what they have tried and which exact line fails, then give a direction, or split or reassign the item.";
|
|
9073
|
-
var claimCheckRule = (how) => `Each time you look in on members, also check that every item you assigned has been moved to In Progress by the member it is assigned to, and that no two members are working on the same item; if an item has not been started or is being worked on twice, ask about it in its comments or reassign it. For each member whose worktree you can read on this machine, also run git status and git log there: if it has uncommitted changes, or commits newer than the last item they delivered, while none of their items is In Progress or waiting for your review, post
|
|
9287
|
+
var claimCheckRule = (how) => `Each time you look in on members, also check that every item you assigned has been moved to In Progress by the member it is assigned to, and that no two members are working on the same item; if an item has not been started or is being worked on twice, ask about it in its comments or reassign it. For each member whose worktree you can read on this machine, also run git status and git log there: if it has uncommitted changes, or commits newer than the last item they delivered, while none of their items is In Progress or waiting for your review, post on the item they are assigned with send_message (to: { workItemId }), with @their name in the text and their memberId in mentions, asking which item they are working on and telling them to ${how} before they change anything else.`;
|
|
9074
9288
|
var LEAD_CLAIM_CHECK_RULE = claimCheckRule("claim it with work_claim_item");
|
|
9075
9289
|
var LEAD_START_CHECK_RULE = claimCheckRule(
|
|
9076
9290
|
"move it to In Progress with work_update_item (do not claim it)"
|
|
@@ -9079,8 +9293,8 @@ var LEAD_SCHEDULE_CHECKIN_RULE = "Before you end a turn while any item of this g
|
|
|
9079
9293
|
var LEAD_SPLIT_RULE = "Use work_create_item to split the goal into a few work items: one item per task, with a clear action in the title. Members do not see this conversation or your goal, so put everything a member needs into the description: the deliverable, the constraints, and how to hand the work in. Create them without assignees.";
|
|
9080
9294
|
var LEAD_OWN_ITEM_RULE = "If a work item for this goal is assigned to you, also record it as blocked by every item you create. Each time a member marks an item done you will be told, so check it then; when they are all done, mark that item done with work_update_item.";
|
|
9081
9295
|
var LEAD_REBALANCE_RULE = "When a member has nothing in progress while another member has an item waiting in line that is not blocked, move one waiting item to the idle member with work_update_item.";
|
|
9082
|
-
var LEAD_CHECKPOINT_RULE = `Members commit and post a one-line progress comment each time they reach a step (a group of tests turns green, a file passes its typecheck, before they change approach, before they stop to wait for someone), and the team plugin mentions a member on an item in progress after ${PROGRESS_CHECKIN_MINUTES} minutes with no progress from them, up to ${PROGRESS_CHECKIN_LIMIT} times in a row. Each time you look in on members, check each item in progress: if the plugin has asked the member and there has been no answer for ${PROGRESS_CHECKIN_LIMIT * PROGRESS_CHECKIN_MINUTES} minutes since its first ask (a member on another machine that has gone offline is asked only once), or the member keeps posting progress but their branch has had no new commit for more than 30 minutes, post
|
|
9083
|
-
var LEAD_SEND_BACK_RULE = 'If a finished item is not acceptable, send it back: use work_update_item to set its state back to an open one (see work_list_states), and change its assignees too if someone else should redo it. Then say what is wrong
|
|
9296
|
+
var LEAD_CHECKPOINT_RULE = `Members commit and post a one-line progress comment each time they reach a step (a group of tests turns green, a file passes its typecheck, before they change approach, before they stop to wait for someone), and the team plugin mentions a member on an item in progress after ${PROGRESS_CHECKIN_MINUTES} minutes with no progress from them, up to ${PROGRESS_CHECKIN_LIMIT} times in a row. Each time you look in on members, check each item in progress: if the plugin has asked the member and there has been no answer for ${PROGRESS_CHECKIN_LIMIT * PROGRESS_CHECKIN_MINUTES} minutes since its first ask (a member on another machine that has gone offline is asked only once), or the member keeps posting progress but their branch has had no new commit for more than 30 minutes, post on the item with send_message (to: { workItemId }), with @their name in the text and their memberId in mentions, that asks them to run the tests and typecheck for what they have changed so far, commit the work in progress to their branch, and post a one-line progress and blocker comment on the item. Take the times from work_history and, when you can read the member's worktree on this machine, from git log -1 --format=%cI there, and compare them with the current time; do not estimate. When you cannot read their worktree, as with a remote member, judge by work_history and comments alone; not being able to see commits does not mean there are none.`;
|
|
9297
|
+
var LEAD_SEND_BACK_RULE = 'If a finished item is not acceptable, send it back: use work_update_item to set its state back to an open one (see work_list_states), and change its assignees too if someone else should redo it. Then say what is wrong on the item with send_message (to: { workItemId }), with @their name in the text and mentions: [{ "memberId": <their memberId> }]; that is what wakes them.';
|
|
9084
9298
|
var LEAD_NO_MEMBER_TASKS = "Do not do members' tasks yourself, and never assign an item you create to yourself: merging, pushing and integrating the work are member tasks too.";
|
|
9085
9299
|
var tableCell = (value) => value.replace(/\|/g, "\\|").replace(/[\r\n]/g, " ");
|
|
9086
9300
|
var ASSIGN_ORDER_RULE = "Assign work to members with no item in progress first; do not give one member two items while another is idle. An item assigned to a local member who already has work waits in line and wakes them after their current item is finished.";
|
|
@@ -9143,14 +9357,14 @@ function leadBrief(goal, roster, options = {}) {
|
|
|
9143
9357
|
|
|
9144
9358
|
// src/domain/goalService.ts
|
|
9145
9359
|
var decodeInput = decodeUnknownOption2(StartGoalInput);
|
|
9146
|
-
var
|
|
9360
|
+
var decodeEnvelope2 = decodeUnknownOption2(
|
|
9147
9361
|
Struct({
|
|
9148
9362
|
pluginId: Literal2("team"),
|
|
9149
9363
|
name: Literal2("team/goal-started"),
|
|
9150
9364
|
data: GoalStartedFact
|
|
9151
9365
|
})
|
|
9152
9366
|
);
|
|
9153
|
-
var decodeGoalFact = (payload) => map(
|
|
9367
|
+
var decodeGoalFact = (payload) => map(decodeEnvelope2(payload), (fact) => fact.data.goal);
|
|
9154
9368
|
var decodeProjectGoalFact = (payload) => filter(decodeGoalFact(payload), isProjectGoal);
|
|
9155
9369
|
var decodeLineGoalFact = (payload) => filter(decodeGoalFact(payload), (goal) => !isProjectGoal(goal));
|
|
9156
9370
|
var decodeBoundEnvelope = decodeUnknownOption2(MemberBoundEnvelope);
|
|
@@ -10651,276 +10865,127 @@ function createMemberWriter(ctx, rosters, queue = createSerial()) {
|
|
|
10651
10865
|
...input.responsibility === void 0 ? {} : { responsibility: input.responsibility },
|
|
10652
10866
|
...input.avatar === void 0 ? {} : { avatar: input.avatar },
|
|
10653
10867
|
...input.workInstructions === void 0 ? {} : { workInstructions: input.workInstructions },
|
|
10654
|
-
...me === void 0 ? {} : { identity: { kind: "human", principal: me } },
|
|
10655
|
-
...agent === void 0 ? {} : { agent }
|
|
10656
|
-
})
|
|
10657
|
-
);
|
|
10658
|
-
return "code" in result2 ? result2 : written(result2);
|
|
10659
|
-
});
|
|
10660
|
-
const update = asPerson("updateMember", async (payload, members, invocation) => {
|
|
10661
|
-
const decoded = decodeUpdate2(payload);
|
|
10662
|
-
if (isNone2(decoded)) return rejectMember("updateMember", "invalid-payload");
|
|
10663
|
-
const input = decoded.value;
|
|
10664
|
-
if (input.avatar !== void 0 && input.clearAvatar === true)
|
|
10665
|
-
return rejectMember("updateMember", "invalid-payload");
|
|
10666
|
-
let identity2;
|
|
10667
|
-
if (input.bindToMe !== void 0) {
|
|
10668
|
-
const me = await meOf("updateMember", invocation);
|
|
10669
|
-
if ("code" in me) return me;
|
|
10670
|
-
const member = await findMember(ctx, input.projectId, input.memberId);
|
|
10671
|
-
if (member === null) return rejectMember("updateMember", "not-found");
|
|
10672
|
-
const held = personOfMember(member);
|
|
10673
|
-
if (held !== null && !samePerson(held, me))
|
|
10674
|
-
return rejectMember("updateMember", "bound-to-other");
|
|
10675
|
-
identity2 = input.bindToMe ? { kind: "human", principal: me } : null;
|
|
10676
|
-
}
|
|
10677
|
-
const result2 = await refused(
|
|
10678
|
-
"updateMember",
|
|
10679
|
-
() => members.update({
|
|
10680
|
-
projectId: input.projectId,
|
|
10681
|
-
requestId: input.requestId,
|
|
10682
|
-
memberId: input.memberId,
|
|
10683
|
-
expectedVersion: input.expectedVersion,
|
|
10684
|
-
...input.name === void 0 ? {} : { name: input.name },
|
|
10685
|
-
...input.title === void 0 ? {} : { title: input.title },
|
|
10686
|
-
...input.responsibility === void 0 ? {} : { responsibility: input.responsibility },
|
|
10687
|
-
...input.clearAvatar === true ? { avatar: null } : input.avatar === void 0 ? {} : { avatar: input.avatar },
|
|
10688
|
-
...input.workInstructions === void 0 ? {} : { workInstructions: input.workInstructions },
|
|
10689
|
-
...input.agent === void 0 ? {} : { agent: toEngineAgent(input.agent) },
|
|
10690
|
-
...identity2 === void 0 ? {} : { identity: identity2 }
|
|
10691
|
-
})
|
|
10692
|
-
);
|
|
10693
|
-
return "code" in result2 ? result2 : written(result2);
|
|
10694
|
-
});
|
|
10695
|
-
const remove = asPerson("removeMember", async (payload, members) => {
|
|
10696
|
-
const decoded = decodeRef2(payload);
|
|
10697
|
-
if (isNone2(decoded)) return rejectMember("removeMember", "invalid-payload");
|
|
10698
|
-
const { projectId, requestId, memberId } = decoded.value;
|
|
10699
|
-
const result2 = await refused(
|
|
10700
|
-
"removeMember",
|
|
10701
|
-
() => members.remove({ projectId, requestId, memberId })
|
|
10702
|
-
);
|
|
10703
|
-
return "code" in result2 ? result2 : written(result2);
|
|
10704
|
-
});
|
|
10705
|
-
const restore = asPerson("restoreMember", async (payload, members) => {
|
|
10706
|
-
const decoded = decodeRef2(payload);
|
|
10707
|
-
if (isNone2(decoded)) return rejectMember("restoreMember", "invalid-payload");
|
|
10708
|
-
const { projectId, requestId, memberId } = decoded.value;
|
|
10709
|
-
const result2 = await refused(
|
|
10710
|
-
"restoreMember",
|
|
10711
|
-
() => members.restore({ projectId, requestId, memberId })
|
|
10712
|
-
);
|
|
10713
|
-
return "code" in result2 ? result2 : written(result2);
|
|
10714
|
-
});
|
|
10715
|
-
const importLegacy = asPerson("importRoster", async (payload, members) => {
|
|
10716
|
-
const decoded = decodeImport(payload);
|
|
10717
|
-
if (isNone2(decoded)) return rejectMember("importRoster", "invalid-payload");
|
|
10718
|
-
const { projectId } = decoded.value;
|
|
10719
|
-
const stored = await rosters.stored(projectId);
|
|
10720
|
-
if (stored?.version !== 1) return rejectMember("importRoster", "nothing-to-import");
|
|
10721
|
-
const legacy = stored.roster;
|
|
10722
|
-
const plan = legacy.members.map((member) => ({
|
|
10723
|
-
member,
|
|
10724
|
-
memberId: importedMemberId(projectId, member.memberId)
|
|
10725
|
-
}));
|
|
10726
|
-
const built = await Promise.all(
|
|
10727
|
-
plan.map((entry) => findMember(ctx, projectId, entry.memberId))
|
|
10728
|
-
);
|
|
10729
|
-
const missing2 = plan.filter((_, index) => built[index] === null);
|
|
10730
|
-
if (missing2.length > 0) {
|
|
10731
|
-
let local;
|
|
10732
|
-
if (missing2.some(({ member }) => member.principal === void 0)) {
|
|
10733
|
-
const fallback = await defaultAgent(ctx, projectId);
|
|
10734
|
-
if ("code" in fallback) return rejectDefault("importRoster", fallback);
|
|
10735
|
-
local = fallback;
|
|
10736
|
-
}
|
|
10737
|
-
const machines = missing2.some(({ member }) => member.principal !== void 0) ? [...(await readMachines(ctx, projectId))?.values() ?? []] : [];
|
|
10738
|
-
const remoteAgentOf = (principalId) => {
|
|
10739
|
-
const machine = machines.find((entry) => entry.principalId === principalId);
|
|
10740
|
-
const provider = machine === void 0 ? void 0 : readyProviders(machine)[0];
|
|
10741
|
-
const model = provider?.defaultModel ?? provider?.models[0]?.slug;
|
|
10742
|
-
return machine === void 0 || provider === void 0 || model === void 0 ? void 0 : {
|
|
10743
|
-
environmentId: machine.environmentId,
|
|
10744
|
-
modelSelection: { instanceId: provider.instanceId, model }
|
|
10745
|
-
};
|
|
10746
|
-
};
|
|
10747
|
-
for (const { member, memberId } of missing2) {
|
|
10748
|
-
const remote = member.principal === void 0 ? void 0 : remoteAgentOf(member.principal.principalId);
|
|
10749
|
-
if (member.principal !== void 0 && remote === void 0)
|
|
10750
|
-
return rejectMember("importRoster", "machine-missing", { memberName: member.name });
|
|
10751
|
-
const created = await refused(
|
|
10752
|
-
"importRoster",
|
|
10753
|
-
() => members.create({
|
|
10754
|
-
projectId,
|
|
10755
|
-
memberId,
|
|
10756
|
-
kind: "agent",
|
|
10757
|
-
name: member.name,
|
|
10758
|
-
...remote === void 0 ? local : { agent: remote }
|
|
10759
|
-
})
|
|
10760
|
-
);
|
|
10761
|
-
if ("code" in created)
|
|
10762
|
-
return rejectMember("importRoster", created.code, { memberName: member.name });
|
|
10763
|
-
}
|
|
10764
|
-
}
|
|
10765
|
-
const adopted = await rosters.adoptImported({
|
|
10766
|
-
projectId,
|
|
10767
|
-
expectedRevision: legacy.revision,
|
|
10768
|
-
leadMemberId: importedMemberId(projectId, legacy.leadMemberId),
|
|
10769
|
-
aliases: Object.fromEntries(plan.map((entry) => [entry.member.memberId, entry.memberId]))
|
|
10770
|
-
});
|
|
10771
|
-
return "code" in adopted ? rejectMember("importRoster", adopted.code) : { revision: adopted.revision, imported: missing2.length };
|
|
10772
|
-
});
|
|
10773
|
-
return { create, update, remove, restore, importLegacy };
|
|
10774
|
-
}
|
|
10775
|
-
|
|
10776
|
-
// src/domain/pause.ts
|
|
10777
|
-
var LinePausedEnvelope = factEnvelope(
|
|
10778
|
-
"line-paused",
|
|
10779
|
-
Struct({
|
|
10780
|
-
version: Literal2(1),
|
|
10781
|
-
status: Literals(["paused", "resumed"]),
|
|
10782
|
-
projectId: String4,
|
|
10783
|
-
workLineId: String4
|
|
10784
|
-
})
|
|
10785
|
-
);
|
|
10786
|
-
var LineMemberPausedEnvelope = factEnvelope(
|
|
10787
|
-
"line-member-paused",
|
|
10788
|
-
Struct({
|
|
10789
|
-
version: Literal2(1),
|
|
10790
|
-
status: Literals(["paused", "resumed"]),
|
|
10791
|
-
projectId: String4,
|
|
10792
|
-
workLineId: String4,
|
|
10793
|
-
memberId: String4
|
|
10794
|
-
})
|
|
10795
|
-
);
|
|
10796
|
-
|
|
10797
|
-
// src/runtime/wakeEvents.ts
|
|
10798
|
-
var MemberWokenFact = Struct({
|
|
10799
|
-
version: Literal2(1),
|
|
10800
|
-
key: String4,
|
|
10801
|
-
projectId: String4,
|
|
10802
|
-
threadId: optionalKey2(String4),
|
|
10803
|
-
principalId: optionalKey2(String4)
|
|
10804
|
-
});
|
|
10805
|
-
var MemberWorktreeFailedFact = Struct({
|
|
10806
|
-
version: Literal2(1),
|
|
10807
|
-
projectId: String4,
|
|
10808
|
-
threadId: String4,
|
|
10809
|
-
reason: String4
|
|
10810
|
-
});
|
|
10811
|
-
var decodeEnvelope2 = decodeUnknownOption2(
|
|
10812
|
-
Union2([
|
|
10813
|
-
Struct({
|
|
10814
|
-
pluginId: Literal2("team"),
|
|
10815
|
-
name: Literal2("team/goal-started"),
|
|
10816
|
-
data: GoalStartedFact
|
|
10817
|
-
}),
|
|
10818
|
-
Struct({
|
|
10819
|
-
pluginId: Literal2("team"),
|
|
10820
|
-
name: Literal2("team/member-woken"),
|
|
10821
|
-
data: MemberWokenFact
|
|
10822
|
-
}),
|
|
10823
|
-
MemberBoundEnvelope,
|
|
10824
|
-
LinePausedEnvelope,
|
|
10825
|
-
LineMemberPausedEnvelope,
|
|
10826
|
-
Struct({
|
|
10827
|
-
pluginId: Literal2("team"),
|
|
10828
|
-
name: Literal2("team/member-worktree-failed"),
|
|
10829
|
-
data: MemberWorktreeFailedFact
|
|
10830
|
-
}),
|
|
10831
|
-
Struct({
|
|
10832
|
-
pluginId: Literal2("team"),
|
|
10833
|
-
name: Literal2("team/member-worktree-reported"),
|
|
10834
|
-
data: Struct({
|
|
10835
|
-
version: Literal2(1),
|
|
10836
|
-
projectId: String4,
|
|
10837
|
-
threadId: String4
|
|
10838
|
-
})
|
|
10839
|
-
})
|
|
10840
|
-
])
|
|
10841
|
-
);
|
|
10842
|
-
var Principal = Union2([
|
|
10843
|
-
Struct({ kind: Literal2("human") }),
|
|
10844
|
-
Struct({ kind: Literal2("agent"), threadId: String4 }),
|
|
10845
|
-
Struct({ kind: Literal2("remote-agent"), principalId: String4 }),
|
|
10846
|
-
Struct({ kind: Literal2("member"), memberId: String4 })
|
|
10847
|
-
]);
|
|
10848
|
-
var Actor = Union2([
|
|
10849
|
-
Principal,
|
|
10850
|
-
Struct({ kind: Literal2("plugin"), pluginId: String4 }),
|
|
10851
|
-
Struct({ kind: Literals(["local-cli", "seat", "system"]) })
|
|
10852
|
-
]);
|
|
10853
|
-
var Updater = Struct({
|
|
10854
|
-
kind: String4,
|
|
10855
|
-
threadId: optionalKey2(String4)
|
|
10856
|
-
});
|
|
10857
|
-
var StateRef = Struct({
|
|
10858
|
-
group: String4,
|
|
10859
|
-
stateId: optionalKey2(String4)
|
|
10860
|
-
});
|
|
10861
|
-
var itemFields = { projectId: String4, workItemId: String4 };
|
|
10862
|
-
var lineField = { workLineId: optional(NullOr(String4)) };
|
|
10863
|
-
var relationFields = {
|
|
10864
|
-
...itemFields,
|
|
10865
|
-
relationKind: String4,
|
|
10866
|
-
relatedWorkItemId: String4
|
|
10867
|
-
};
|
|
10868
|
-
var decodeWorkEvent = decodeUnknownOption2(
|
|
10869
|
-
Union2([
|
|
10870
|
-
Struct({
|
|
10871
|
-
type: Literal2("work.item-created"),
|
|
10872
|
-
payload: Struct({
|
|
10873
|
-
...itemFields,
|
|
10874
|
-
sequenceId: Number5,
|
|
10875
|
-
assignees: ArraySchema(Principal),
|
|
10876
|
-
state: StateRef,
|
|
10877
|
-
...lineField
|
|
10878
|
-
})
|
|
10879
|
-
}),
|
|
10880
|
-
Struct({
|
|
10881
|
-
type: Literal2("work.item-updated"),
|
|
10882
|
-
payload: Struct({
|
|
10883
|
-
...itemFields,
|
|
10884
|
-
assignees: optional(ArraySchema(Principal)),
|
|
10885
|
-
state: optional(StateRef),
|
|
10886
|
-
actor: optional(Updater),
|
|
10887
|
-
...lineField
|
|
10888
|
-
})
|
|
10889
|
-
}),
|
|
10890
|
-
Struct({
|
|
10891
|
-
type: Literal2("work.item-claimed"),
|
|
10892
|
-
payload: Struct({
|
|
10893
|
-
...itemFields,
|
|
10894
|
-
assignee: Principal,
|
|
10895
|
-
state: optional(StateRef)
|
|
10868
|
+
...me === void 0 ? {} : { identity: { kind: "human", principal: me } },
|
|
10869
|
+
...agent === void 0 ? {} : { agent }
|
|
10896
10870
|
})
|
|
10897
|
-
|
|
10898
|
-
|
|
10899
|
-
|
|
10900
|
-
|
|
10901
|
-
|
|
10902
|
-
|
|
10903
|
-
|
|
10904
|
-
|
|
10905
|
-
|
|
10906
|
-
|
|
10907
|
-
|
|
10908
|
-
|
|
10909
|
-
|
|
10910
|
-
|
|
10911
|
-
|
|
10912
|
-
|
|
10913
|
-
|
|
10871
|
+
);
|
|
10872
|
+
return "code" in result2 ? result2 : written(result2);
|
|
10873
|
+
});
|
|
10874
|
+
const update = asPerson("updateMember", async (payload, members, invocation) => {
|
|
10875
|
+
const decoded = decodeUpdate2(payload);
|
|
10876
|
+
if (isNone2(decoded)) return rejectMember("updateMember", "invalid-payload");
|
|
10877
|
+
const input = decoded.value;
|
|
10878
|
+
if (input.avatar !== void 0 && input.clearAvatar === true)
|
|
10879
|
+
return rejectMember("updateMember", "invalid-payload");
|
|
10880
|
+
let identity2;
|
|
10881
|
+
if (input.bindToMe !== void 0) {
|
|
10882
|
+
const me = await meOf("updateMember", invocation);
|
|
10883
|
+
if ("code" in me) return me;
|
|
10884
|
+
const member = await findMember(ctx, input.projectId, input.memberId);
|
|
10885
|
+
if (member === null) return rejectMember("updateMember", "not-found");
|
|
10886
|
+
const held = personOfMember(member);
|
|
10887
|
+
if (held !== null && !samePerson(held, me))
|
|
10888
|
+
return rejectMember("updateMember", "bound-to-other");
|
|
10889
|
+
identity2 = input.bindToMe ? { kind: "human", principal: me } : null;
|
|
10890
|
+
}
|
|
10891
|
+
const result2 = await refused(
|
|
10892
|
+
"updateMember",
|
|
10893
|
+
() => members.update({
|
|
10894
|
+
projectId: input.projectId,
|
|
10895
|
+
requestId: input.requestId,
|
|
10896
|
+
memberId: input.memberId,
|
|
10897
|
+
expectedVersion: input.expectedVersion,
|
|
10898
|
+
...input.name === void 0 ? {} : { name: input.name },
|
|
10899
|
+
...input.title === void 0 ? {} : { title: input.title },
|
|
10900
|
+
...input.responsibility === void 0 ? {} : { responsibility: input.responsibility },
|
|
10901
|
+
...input.clearAvatar === true ? { avatar: null } : input.avatar === void 0 ? {} : { avatar: input.avatar },
|
|
10902
|
+
...input.workInstructions === void 0 ? {} : { workInstructions: input.workInstructions },
|
|
10903
|
+
...input.agent === void 0 ? {} : { agent: toEngineAgent(input.agent) },
|
|
10904
|
+
...identity2 === void 0 ? {} : { identity: identity2 }
|
|
10914
10905
|
})
|
|
10915
|
-
|
|
10916
|
-
|
|
10917
|
-
);
|
|
10918
|
-
|
|
10919
|
-
|
|
10920
|
-
|
|
10921
|
-
|
|
10922
|
-
|
|
10923
|
-
|
|
10906
|
+
);
|
|
10907
|
+
return "code" in result2 ? result2 : written(result2);
|
|
10908
|
+
});
|
|
10909
|
+
const remove = asPerson("removeMember", async (payload, members) => {
|
|
10910
|
+
const decoded = decodeRef2(payload);
|
|
10911
|
+
if (isNone2(decoded)) return rejectMember("removeMember", "invalid-payload");
|
|
10912
|
+
const { projectId, requestId, memberId } = decoded.value;
|
|
10913
|
+
const result2 = await refused(
|
|
10914
|
+
"removeMember",
|
|
10915
|
+
() => members.remove({ projectId, requestId, memberId })
|
|
10916
|
+
);
|
|
10917
|
+
return "code" in result2 ? result2 : written(result2);
|
|
10918
|
+
});
|
|
10919
|
+
const restore = asPerson("restoreMember", async (payload, members) => {
|
|
10920
|
+
const decoded = decodeRef2(payload);
|
|
10921
|
+
if (isNone2(decoded)) return rejectMember("restoreMember", "invalid-payload");
|
|
10922
|
+
const { projectId, requestId, memberId } = decoded.value;
|
|
10923
|
+
const result2 = await refused(
|
|
10924
|
+
"restoreMember",
|
|
10925
|
+
() => members.restore({ projectId, requestId, memberId })
|
|
10926
|
+
);
|
|
10927
|
+
return "code" in result2 ? result2 : written(result2);
|
|
10928
|
+
});
|
|
10929
|
+
const importLegacy = asPerson("importRoster", async (payload, members) => {
|
|
10930
|
+
const decoded = decodeImport(payload);
|
|
10931
|
+
if (isNone2(decoded)) return rejectMember("importRoster", "invalid-payload");
|
|
10932
|
+
const { projectId } = decoded.value;
|
|
10933
|
+
const stored = await rosters.stored(projectId);
|
|
10934
|
+
if (stored?.version !== 1) return rejectMember("importRoster", "nothing-to-import");
|
|
10935
|
+
const legacy = stored.roster;
|
|
10936
|
+
const plan = legacy.members.map((member) => ({
|
|
10937
|
+
member,
|
|
10938
|
+
memberId: importedMemberId(projectId, member.memberId)
|
|
10939
|
+
}));
|
|
10940
|
+
const built = await Promise.all(
|
|
10941
|
+
plan.map((entry) => findMember(ctx, projectId, entry.memberId))
|
|
10942
|
+
);
|
|
10943
|
+
const missing2 = plan.filter((_, index) => built[index] === null);
|
|
10944
|
+
if (missing2.length > 0) {
|
|
10945
|
+
let local;
|
|
10946
|
+
if (missing2.some(({ member }) => member.principal === void 0)) {
|
|
10947
|
+
const fallback = await defaultAgent(ctx, projectId);
|
|
10948
|
+
if ("code" in fallback) return rejectDefault("importRoster", fallback);
|
|
10949
|
+
local = fallback;
|
|
10950
|
+
}
|
|
10951
|
+
const machines = missing2.some(({ member }) => member.principal !== void 0) ? [...(await readMachines(ctx, projectId))?.values() ?? []] : [];
|
|
10952
|
+
const remoteAgentOf = (principalId) => {
|
|
10953
|
+
const machine = machines.find((entry) => entry.principalId === principalId);
|
|
10954
|
+
const provider = machine === void 0 ? void 0 : readyProviders(machine)[0];
|
|
10955
|
+
const model = provider?.defaultModel ?? provider?.models[0]?.slug;
|
|
10956
|
+
return machine === void 0 || provider === void 0 || model === void 0 ? void 0 : {
|
|
10957
|
+
environmentId: machine.environmentId,
|
|
10958
|
+
modelSelection: { instanceId: provider.instanceId, model }
|
|
10959
|
+
};
|
|
10960
|
+
};
|
|
10961
|
+
for (const { member, memberId } of missing2) {
|
|
10962
|
+
const remote = member.principal === void 0 ? void 0 : remoteAgentOf(member.principal.principalId);
|
|
10963
|
+
if (member.principal !== void 0 && remote === void 0)
|
|
10964
|
+
return rejectMember("importRoster", "machine-missing", { memberName: member.name });
|
|
10965
|
+
const created = await refused(
|
|
10966
|
+
"importRoster",
|
|
10967
|
+
() => members.create({
|
|
10968
|
+
projectId,
|
|
10969
|
+
memberId,
|
|
10970
|
+
kind: "agent",
|
|
10971
|
+
name: member.name,
|
|
10972
|
+
...remote === void 0 ? local : { agent: remote }
|
|
10973
|
+
})
|
|
10974
|
+
);
|
|
10975
|
+
if ("code" in created)
|
|
10976
|
+
return rejectMember("importRoster", created.code, { memberName: member.name });
|
|
10977
|
+
}
|
|
10978
|
+
}
|
|
10979
|
+
const adopted = await rosters.adoptImported({
|
|
10980
|
+
projectId,
|
|
10981
|
+
expectedRevision: legacy.revision,
|
|
10982
|
+
leadMemberId: importedMemberId(projectId, legacy.leadMemberId),
|
|
10983
|
+
aliases: Object.fromEntries(plan.map((entry) => [entry.member.memberId, entry.memberId]))
|
|
10984
|
+
});
|
|
10985
|
+
return "code" in adopted ? rejectMember("importRoster", adopted.code) : { revision: adopted.revision, imported: missing2.length };
|
|
10986
|
+
});
|
|
10987
|
+
return { create, update, remove, restore, importLegacy };
|
|
10988
|
+
}
|
|
10924
10989
|
|
|
10925
10990
|
// src/runtime/deliveryPacing.ts
|
|
10926
10991
|
var pairKey = (a, b) => JSON.stringify([a, b].sort());
|
|
@@ -11308,9 +11373,12 @@ var itemWakeCandidate = (projectId, project2, workItemId, item, threadId, woken,
|
|
|
11308
11373
|
sequenceId: item.sequenceId,
|
|
11309
11374
|
...memberId === void 0 ? {} : { memberId },
|
|
11310
11375
|
// 成员的叫醒话里点名负责人(卡住时找谁);带队自己和解挡续做不带。
|
|
11311
|
-
...lead ? { lead: true } : finishing
|
|
11312
|
-
leadThreadId
|
|
11313
|
-
|
|
11376
|
+
...lead ? { lead: true } : finishing ? {} : {
|
|
11377
|
+
...leadThreadId === void 0 ? {} : {
|
|
11378
|
+
leadThreadId,
|
|
11379
|
+
...room === void 0 || room === leadThreadId ? {} : { roomThreadId: room }
|
|
11380
|
+
},
|
|
11381
|
+
...scope2?.leadMemberId === void 0 ? {} : { leadMemberId: scope2.leadMemberId }
|
|
11314
11382
|
}
|
|
11315
11383
|
};
|
|
11316
11384
|
};
|
|
@@ -12318,6 +12386,7 @@ function dueRecoveries(state, changedThreadId) {
|
|
|
12318
12386
|
workItemId,
|
|
12319
12387
|
sequenceId: item.sequenceId,
|
|
12320
12388
|
lastCommentId: item.lastCommentId,
|
|
12389
|
+
lastCommentFromPost: item.lastCommentFromPost === true,
|
|
12321
12390
|
waitingForReply: item.lastActionCommentThreadId === threadId
|
|
12322
12391
|
})).sort((a, b) => a.sequenceId - b.sequenceId);
|
|
12323
12392
|
const deferredWakeCount = countDeferredWakes(project2, threadId);
|
|
@@ -12361,7 +12430,7 @@ var itemHeadline = (sequenceId, item) => {
|
|
|
12361
12430
|
return parts.length === 0 ? "" : `${parts.join(" ")} `;
|
|
12362
12431
|
};
|
|
12363
12432
|
var startClause = (member) => member === void 0 ? "Otherwise claim it with work_claim_item before you change any file." : "Otherwise start it before you change any file: use work_update_item to move it into an in-progress state (see work_list_states) and leave its assignees as they are. It is assigned to you as a team member, so do not claim it with work_claim_item; claiming is for work nobody holds.";
|
|
12364
|
-
var itemText = (workItemId, sequenceId, item, leadThreadId, member, roomThreadId) => `${itemHeadline(sequenceId, item)}You have ${workLabel(workItemId, sequenceId)}. ${handbookMessage("memberBrief")} Then read it with work_read_items, passing workItemIds: ["${workItemId}"]. If it is blocked by items that are not done yet, do not start it; you will be told again when they are done. ${startClause(member)}${memberInstructionsClause(member)} Before you change anything, search this repository's rules and checks with memory_search and follow what applies. Then work on it. ${MEMBER_READ_RANGES_RULE} ${MEMBER_NO_STASH_RULE} ${MEMBER_ASK_BEFORE_OUTSIDE_RULE} ${MEMBER_CHECKS_RULE} ${MEMBER_PROGRESS_RULE} ${memberStuckRule(
|
|
12433
|
+
var itemText = (workItemId, sequenceId, item, leadThreadId, member, roomThreadId, lead) => `${itemHeadline(sequenceId, item)}You have ${workLabel(workItemId, sequenceId)}. ${handbookMessage("memberBrief")} Then read it with work_read_items, passing workItemIds: ["${workItemId}"]. If it is blocked by items that are not done yet, do not start it; you will be told again when they are done. ${startClause(member)}${memberInstructionsClause(member)} Before you change anything, search this repository's rules and checks with memory_search and follow what applies. Then work on it. ${MEMBER_READ_RANGES_RULE} ${MEMBER_NO_STASH_RULE} ${MEMBER_ASK_BEFORE_OUTSIDE_RULE} ${MEMBER_CHECKS_RULE} ${MEMBER_PROGRESS_RULE} ${memberStuckRule(lead)}${roomThreadId === void 0 ? memberGroupRule(leadThreadId) : memberGroupRule(roomThreadId, false)} ${PERSON_MESSAGE_RULE}`;
|
|
12365
12434
|
var leadItemText = (workItemId, sequenceId, title) => `You have ${titled(workItemId, sequenceId, title)}. You lead this team, so this item is the goal itself: do not claim it or do its work yourself. Read it with work_read_items, passing workItemIds: ["${workItemId}"]. If it has no work items yet, split it as your team brief says. ${LEAD_SPLIT_RULE} ${LEAD_OWN_ITEM_RULE} Record dependencies and assign each item to one member as the brief describes. ${LEAD_NO_MEMBER_TASKS} ${PERSON_MESSAGE_RULE}`;
|
|
12366
12435
|
var leadUnblockedText = (workItemId, sequenceId, title) => `Everything blocking ${titled(workItemId, sequenceId, title)} is done now. Read those items with work_read_items and check the results. ${LEAD_ACCEPT_RULE} ${LEAD_SEND_BACK_RULE} When all of them are acceptable, mark this item done with work_update_item. ${LEAD_NO_MEMBER_TASKS}`;
|
|
12367
12436
|
var unblockedText = (workItemId, sequenceId, title) => `Everything blocking ${titled(workItemId, sequenceId, title)} is done now. Read those items with work_read_items, finish this one, and mark it done with work_update_item.`;
|
|
@@ -12476,6 +12545,75 @@ function foldLineLead(state, event) {
|
|
|
12476
12545
|
};
|
|
12477
12546
|
}
|
|
12478
12547
|
|
|
12548
|
+
// src/runtime/lineStopsFold.ts
|
|
12549
|
+
var decodeLineLifecycle = decodeUnknownOption2(
|
|
12550
|
+
Struct({ projectId: String4, workLineId: String4 })
|
|
12551
|
+
);
|
|
12552
|
+
var decodeThreadDeleted = decodeUnknownOption2(Struct({ threadId: String4 }));
|
|
12553
|
+
function foldLineStops(state, event) {
|
|
12554
|
+
if (event.type === "work.line-archived" || event.type === "work.line-restored") {
|
|
12555
|
+
const lifecycle = decodeLineLifecycle(event.payload);
|
|
12556
|
+
if (isNone2(lifecycle)) return state;
|
|
12557
|
+
const { projectId, workLineId } = lifecycle.value;
|
|
12558
|
+
const project2 = readFact(state, projectId);
|
|
12559
|
+
if (project2?.lineScopes?.[workLineId] === void 0) return state;
|
|
12560
|
+
const known = project2.lineStops?.[workLineId];
|
|
12561
|
+
if (event.type === "work.line-archived") {
|
|
12562
|
+
return known === void 0 ? {
|
|
12563
|
+
...state,
|
|
12564
|
+
[projectId]: {
|
|
12565
|
+
...project2,
|
|
12566
|
+
lineStops: { ...project2.lineStops, [workLineId]: "archived" }
|
|
12567
|
+
}
|
|
12568
|
+
} : state;
|
|
12569
|
+
}
|
|
12570
|
+
if (known !== "archived") return state;
|
|
12571
|
+
return {
|
|
12572
|
+
...state,
|
|
12573
|
+
[projectId]: { ...project2, lineStops: without(project2.lineStops ?? {}, workLineId) }
|
|
12574
|
+
};
|
|
12575
|
+
}
|
|
12576
|
+
if (event.type !== "thread.deleted") return state;
|
|
12577
|
+
const deleted = decodeThreadDeleted(event.payload);
|
|
12578
|
+
if (isNone2(deleted)) return state;
|
|
12579
|
+
const next = { ...state };
|
|
12580
|
+
for (const [projectId, project2] of Object.entries(state)) {
|
|
12581
|
+
const lines = Object.entries(project2.lineScopes ?? {}).filter(
|
|
12582
|
+
([, scope2]) => roomOf(scope2) === deleted.value.threadId
|
|
12583
|
+
);
|
|
12584
|
+
if (lines.length === 0) continue;
|
|
12585
|
+
next[projectId] = {
|
|
12586
|
+
...project2,
|
|
12587
|
+
lineStops: {
|
|
12588
|
+
...project2.lineStops,
|
|
12589
|
+
...Object.fromEntries(lines.map(([workLineId]) => [workLineId, "deleted"]))
|
|
12590
|
+
}
|
|
12591
|
+
};
|
|
12592
|
+
}
|
|
12593
|
+
return next;
|
|
12594
|
+
}
|
|
12595
|
+
|
|
12596
|
+
// src/runtime/removedPostFold.ts
|
|
12597
|
+
function foldRemovedPost(state, removed) {
|
|
12598
|
+
const project2 = readFact(state, removed.projectId);
|
|
12599
|
+
if (project2 === null) return state;
|
|
12600
|
+
const hit = Object.entries(project2.items).filter(
|
|
12601
|
+
([, item]) => item.lastCommentFromPost === true && item.lastCommentId === removed.postId
|
|
12602
|
+
);
|
|
12603
|
+
if (hit.length === 0) return state;
|
|
12604
|
+
const items = { ...project2.items };
|
|
12605
|
+
for (const [workItemId, item] of hit) {
|
|
12606
|
+
const {
|
|
12607
|
+
lastCommentId: _gone,
|
|
12608
|
+
lastActionCommentThreadId: _author,
|
|
12609
|
+
lastCommentFromPost: _post,
|
|
12610
|
+
...rest
|
|
12611
|
+
} = item;
|
|
12612
|
+
items[workItemId] = rest;
|
|
12613
|
+
}
|
|
12614
|
+
return { ...state, [removed.projectId]: { ...project2, items } };
|
|
12615
|
+
}
|
|
12616
|
+
|
|
12479
12617
|
// src/runtime/linePauseFold.ts
|
|
12480
12618
|
var EnginePause = Struct({
|
|
12481
12619
|
projectId: String4,
|
|
@@ -12532,7 +12670,7 @@ function withPause(project2, change, legacyEventId) {
|
|
|
12532
12670
|
|
|
12533
12671
|
// src/runtime/wakeState.ts
|
|
12534
12672
|
var WAKE_STATE_KEY = "wakes";
|
|
12535
|
-
var WAKE_STATE_VERSION =
|
|
12673
|
+
var WAKE_STATE_VERSION = 13;
|
|
12536
12674
|
var WAKE_EVENTS = [
|
|
12537
12675
|
"work.item-created",
|
|
12538
12676
|
"work.item-updated",
|
|
@@ -12540,6 +12678,10 @@ var WAKE_EVENTS = [
|
|
|
12540
12678
|
"work.relation-added",
|
|
12541
12679
|
"work.relation-removed",
|
|
12542
12680
|
"work.comment-posted",
|
|
12681
|
+
// 工作项上的发言就是这件上的评论(见 `asItemComment`);撤回、删除只为清掉最近一条评论。
|
|
12682
|
+
"communication.post-sent",
|
|
12683
|
+
"communication.post-withdrawn",
|
|
12684
|
+
"communication.post-deleted",
|
|
12543
12685
|
// 看板把件交到了成员会话上(引擎叫醒了它):当成这一次「你有活」已经叫过,占名额、固定执行者都照旧。
|
|
12544
12686
|
"work.item-dispatched",
|
|
12545
12687
|
"plugin.event-appended",
|
|
@@ -12661,7 +12803,7 @@ var markBlockedAfterClaim = (project2, workItemId) => ({
|
|
|
12661
12803
|
});
|
|
12662
12804
|
function foldWorkWakes(state, event) {
|
|
12663
12805
|
if (event.type === "plugin.event-appended") {
|
|
12664
|
-
const decoded2 =
|
|
12806
|
+
const decoded2 = decodeEnvelope(event.payload);
|
|
12665
12807
|
if (isNone2(decoded2)) return state;
|
|
12666
12808
|
const fact = decoded2.value;
|
|
12667
12809
|
if (fact.name === "team/goal-started") {
|
|
@@ -12889,15 +13031,18 @@ function foldWorkWakes(state, event) {
|
|
|
12889
13031
|
}
|
|
12890
13032
|
// 评论里 @ 谁、回复谁由引擎投递(提案 0085 切片 3);这里只记最近一条评论,恢复与问进度要用。
|
|
12891
13033
|
case "work.comment-posted": {
|
|
12892
|
-
const { actor, commentId } = work.payload;
|
|
13034
|
+
const { actor, commentId, fromPost } = work.payload;
|
|
13035
|
+
if (currentItem === null) break;
|
|
13036
|
+
const { lastCommentFromPost: _previous, ...item } = currentItem;
|
|
12893
13037
|
next = {
|
|
12894
13038
|
...project2,
|
|
12895
|
-
items:
|
|
13039
|
+
items: {
|
|
12896
13040
|
...project2.items,
|
|
12897
13041
|
[workItemId]: {
|
|
12898
|
-
...
|
|
13042
|
+
...item,
|
|
12899
13043
|
lastCommentId: commentId,
|
|
12900
|
-
lastActionCommentThreadId: actor.kind === "agent" ? actor.threadId : null
|
|
13044
|
+
lastActionCommentThreadId: actor.kind === "agent" ? actor.threadId : null,
|
|
13045
|
+
...fromPost === true ? { lastCommentFromPost: true } : {}
|
|
12901
13046
|
}
|
|
12902
13047
|
}
|
|
12903
13048
|
};
|
|
@@ -12906,52 +13051,6 @@ function foldWorkWakes(state, event) {
|
|
|
12906
13051
|
}
|
|
12907
13052
|
return { ...state, [projectId]: next };
|
|
12908
13053
|
}
|
|
12909
|
-
var decodeLineLifecycle = decodeUnknownOption2(
|
|
12910
|
-
Struct({ projectId: String4, workLineId: String4 })
|
|
12911
|
-
);
|
|
12912
|
-
var decodeThreadDeleted = decodeUnknownOption2(Struct({ threadId: String4 }));
|
|
12913
|
-
function foldLineStops(state, event) {
|
|
12914
|
-
if (event.type === "work.line-archived" || event.type === "work.line-restored") {
|
|
12915
|
-
const lifecycle = decodeLineLifecycle(event.payload);
|
|
12916
|
-
if (isNone2(lifecycle)) return state;
|
|
12917
|
-
const { projectId, workLineId } = lifecycle.value;
|
|
12918
|
-
const project2 = readFact(state, projectId);
|
|
12919
|
-
if (project2?.lineScopes?.[workLineId] === void 0) return state;
|
|
12920
|
-
const known = project2.lineStops?.[workLineId];
|
|
12921
|
-
if (event.type === "work.line-archived") {
|
|
12922
|
-
return known === void 0 ? {
|
|
12923
|
-
...state,
|
|
12924
|
-
[projectId]: {
|
|
12925
|
-
...project2,
|
|
12926
|
-
lineStops: { ...project2.lineStops, [workLineId]: "archived" }
|
|
12927
|
-
}
|
|
12928
|
-
} : state;
|
|
12929
|
-
}
|
|
12930
|
-
if (known !== "archived") return state;
|
|
12931
|
-
return {
|
|
12932
|
-
...state,
|
|
12933
|
-
[projectId]: { ...project2, lineStops: without(project2.lineStops ?? {}, workLineId) }
|
|
12934
|
-
};
|
|
12935
|
-
}
|
|
12936
|
-
if (event.type !== "thread.deleted") return state;
|
|
12937
|
-
const deleted = decodeThreadDeleted(event.payload);
|
|
12938
|
-
if (isNone2(deleted)) return state;
|
|
12939
|
-
const next = { ...state };
|
|
12940
|
-
for (const [projectId, project2] of Object.entries(state)) {
|
|
12941
|
-
const lines = Object.entries(project2.lineScopes ?? {}).filter(
|
|
12942
|
-
([, scope2]) => roomOf(scope2) === deleted.value.threadId
|
|
12943
|
-
);
|
|
12944
|
-
if (lines.length === 0) continue;
|
|
12945
|
-
next[projectId] = {
|
|
12946
|
-
...project2,
|
|
12947
|
-
lineStops: {
|
|
12948
|
-
...project2.lineStops,
|
|
12949
|
-
...Object.fromEntries(lines.map(([workLineId]) => [workLineId, "deleted"]))
|
|
12950
|
-
}
|
|
12951
|
-
};
|
|
12952
|
-
}
|
|
12953
|
-
return next;
|
|
12954
|
-
}
|
|
12955
13054
|
function foldEnginePause(state, event) {
|
|
12956
13055
|
const change = pauseOfEngineEvent(event);
|
|
12957
13056
|
if (change === null) return state;
|
|
@@ -12959,7 +13058,10 @@ function foldEnginePause(state, event) {
|
|
|
12959
13058
|
const next = withPause(project2, change);
|
|
12960
13059
|
return next === project2 ? state : { ...state, [change.projectId]: next };
|
|
12961
13060
|
}
|
|
12962
|
-
function foldWakes(state,
|
|
13061
|
+
function foldWakes(state, raw) {
|
|
13062
|
+
const removed = removedPost(raw);
|
|
13063
|
+
if (removed !== null) return foldRemovedPost(state, removed);
|
|
13064
|
+
const event = asItemComment(raw);
|
|
12963
13065
|
if (event.type === "work.line-paused" || event.type === "work.line-resumed")
|
|
12964
13066
|
return foldEnginePause(state, event);
|
|
12965
13067
|
if (event.type === "work.line-updated") return foldLineLead(state, event);
|
|
@@ -12999,6 +13101,10 @@ function startWakeRuntime(ctx, goals, options = {}) {
|
|
|
12999
13101
|
revision: member?.workInstructionsRevision ?? null
|
|
13000
13102
|
};
|
|
13001
13103
|
};
|
|
13104
|
+
const readLead = async (projectId, memberId) => {
|
|
13105
|
+
const member = await findMember(ctx, projectId, memberId);
|
|
13106
|
+
return member === null || member === void 0 || member.removedAt !== null ? void 0 : { memberId, name: member.name };
|
|
13107
|
+
};
|
|
13002
13108
|
const baseText = async (wake, state) => {
|
|
13003
13109
|
const item = await readItem(wake.projectId, wake.workItemId);
|
|
13004
13110
|
const title = item?.title;
|
|
@@ -13031,7 +13137,8 @@ function startWakeRuntime(ctx, goals, options = {}) {
|
|
|
13031
13137
|
item,
|
|
13032
13138
|
wake.leadThreadId,
|
|
13033
13139
|
wake.memberId === void 0 ? void 0 : await readMemberBrief(wake.projectId, wake.memberId),
|
|
13034
|
-
wake.roomThreadId
|
|
13140
|
+
wake.roomThreadId,
|
|
13141
|
+
wake.leadMemberId === void 0 ? void 0 : await readLead(wake.projectId, wake.leadMemberId)
|
|
13035
13142
|
);
|
|
13036
13143
|
return (wake.lead === true ? leadUnblockedText : unblockedText)(
|
|
13037
13144
|
wake.workItemId,
|
|
@@ -13241,18 +13348,19 @@ function startWorktreeSetupRuntime(ctx, deps) {
|
|
|
13241
13348
|
|
|
13242
13349
|
// src/runtime/recovery.ts
|
|
13243
13350
|
var itemLabel = (item) => `W${item.sequenceId} (workItemId ${item.workItemId})`;
|
|
13351
|
+
var commentRef = (item) => `message_read refs [{ kind: "${item.lastCommentFromPost ? "post" : "comment"}", id: "${item.lastCommentId ?? ""}" }]`;
|
|
13244
13352
|
var deferredText = (recovery) => recovery.deferredWakeCount === void 0 ? "" : `They also have ${recovery.deferredWakeCount} assigned ${recovery.deferredWakeCount === 1 ? "item that has" : "items that have"} not been woken yet. `;
|
|
13245
13353
|
var leadText = (recovery, name, paused) => `Member ${name} (threadId ${recovery.threadId}) ${recovery.afterTurnId === void 0 ? "stopped because of an upstream error" : "could not start a session"} (${recovery.category}). ${recovery.items.map(itemLabel).join(", ")} ${recovery.items.length === 1 ? "is" : "are"} still open. ${deferredText(recovery)}${recovery.alreadyRetried ? "An automatic continuation has already been attempted for this work during these consecutive failures. " : ""}${leadInstructions(paused)}`;
|
|
13246
13354
|
var commentInstructions = (recovery) => recovery.items.map(
|
|
13247
|
-
(item) => item.lastCommentId === void 0 ? `${itemLabel(item)} has no comments yet. Continue from your existing workspace changes and turn history.` : `For ${itemLabel(item)}, the latest comment is
|
|
13355
|
+
(item) => item.lastCommentId === void 0 ? `${itemLabel(item)} has no comments yet. Continue from your existing workspace changes and turn history.` : `For ${itemLabel(item)}, the latest comment is ${commentRef(item)}. Read the item's discussion with message_list (workItemId: "${item.workItemId}") and continue from that comment and your existing workspace changes; do not start over.`
|
|
13248
13356
|
).join("\n");
|
|
13249
|
-
var leadInstructions = (paused = false) => `${paused ? "Their sending is paused; a person needs to click Resume sending. " : ""}You can post
|
|
13357
|
+
var leadInstructions = (paused = false) => `${paused ? "Their sending is paused; a person needs to click Resume sending. " : ""}You can post on the item with send_message (to: { workItemId }), with @their name in the text and their memberId in mentions, to ask them to continue (the mention wakes them), reassign the work with work_update_item, or report the problem to the person.${paused ? " The post will wait until the person resumes sending." : ""}`;
|
|
13250
13358
|
var resumeText = (recovery) => `Your previous turn was interrupted by an upstream error (${recovery.category}). Continue ${recovery.items.map(itemLabel).join(", ")} from where you stopped.
|
|
13251
13359
|
${commentInstructions(recovery)}`;
|
|
13252
|
-
var remindText = (recovery) => `Your turn ended normally, but ${recovery.items.map(itemLabel).join(", ")} ${recovery.items.length === 1 ? "is" : "are"} still in progress. If finished, mark the work done with work_update_item. If blocked, explain where you are stuck on the item with
|
|
13360
|
+
var remindText = (recovery) => `Your turn ended normally, but ${recovery.items.map(itemLabel).join(", ")} ${recovery.items.length === 1 ? "is" : "are"} still in progress. If finished, mark the work done with work_update_item. If blocked, explain where you are stuck on the item with send_message (to: { workItemId }). Otherwise continue from where you stopped; do not start over.
|
|
13253
13361
|
${commentInstructions(recovery)}`;
|
|
13254
13362
|
var stallLeadText = (recovery, name) => `Member ${name} (threadId ${recovery.threadId}) ended this turn normally, but ${recovery.items.map(itemLabel).join(", ")} ${recovery.items.length === 1 ? "is" : "are"} still open. ${deferredText(recovery)}${recovery.alreadyRetried ? "They have already been reminded once to continue this work, with no progress since. " : ""}${recovery.items.filter((item) => item.waitingForReply).map(
|
|
13255
|
-
(item) => `Their last action on ${itemLabel(item)} was their own comment (
|
|
13363
|
+
(item) => `Their last action on ${itemLabel(item)} was their own comment (${commentRef(item)}); reply to it or arrange another member to help. `
|
|
13256
13364
|
).join("")}${leadInstructions()}`;
|
|
13257
13365
|
function startRecoveryRuntime(ctx, goals, state, worktrees) {
|
|
13258
13366
|
let pending = Promise.resolve();
|
|
@@ -13444,6 +13552,8 @@ function startRecoveryRuntime(ctx, goals, state, worktrees) {
|
|
|
13444
13552
|
"work.item-updated",
|
|
13445
13553
|
"work.item-claimed",
|
|
13446
13554
|
"work.comment-posted",
|
|
13555
|
+
// 工作项上的发言就是这件上的评论;挂在会话、人身上的发言不碰恢复(见 handle)。
|
|
13556
|
+
"communication.post-sent",
|
|
13447
13557
|
"work.relation-added",
|
|
13448
13558
|
"work.relation-removed",
|
|
13449
13559
|
"thread.turn-intent-queued",
|
|
@@ -13454,7 +13564,7 @@ function startRecoveryRuntime(ctx, goals, state, worktrees) {
|
|
|
13454
13564
|
// 线或成员恢复:暂停期间扣下的恢复计划补发。
|
|
13455
13565
|
"work.line-resumed"
|
|
13456
13566
|
],
|
|
13457
|
-
handle: (event) => flush(recoveryEventScopeOf(event))
|
|
13567
|
+
handle: (event) => event.type === "communication.post-sent" && asItemComment(event) === event ? Promise.resolve() : flush(recoveryEventScopeOf(event))
|
|
13458
13568
|
});
|
|
13459
13569
|
ctx.onDispose(() => {
|
|
13460
13570
|
disposed = true;
|
|
@@ -13568,7 +13678,7 @@ async function sampleCapacityWait(ctx, ledger, threadId, at) {
|
|
|
13568
13678
|
|
|
13569
13679
|
// src/runtime/progressCheckin.ts
|
|
13570
13680
|
var MEMBER_PREFIX = "member:";
|
|
13571
|
-
var PROGRESS_CHECKIN_TEXT = `How far along are you on this item? There has been no progress from you here for ${PROGRESS_CHECKIN_MINUTES} minutes. Commit what you have to your branch first (a work-in-progress commit is fine), then reply here with
|
|
13681
|
+
var PROGRESS_CHECKIN_TEXT = `How far along are you on this item? There has been no progress from you here for ${PROGRESS_CHECKIN_MINUTES} minutes. Commit what you have to your branch first (a work-in-progress commit is fine), then reply here with send_message (to: { workItemId } of this item, replyTo this post): one line of progress and any blocker.`;
|
|
13572
13682
|
var TICK_MS = 6e4;
|
|
13573
13683
|
var assigneeKey = (principal) => {
|
|
13574
13684
|
if (principal.kind === "member" && principal.memberId !== void 0)
|
|
@@ -13580,14 +13690,15 @@ var assigneeKeys = (principals) => principals.flatMap((principal) => {
|
|
|
13580
13690
|
const key = assigneeKey(principal);
|
|
13581
13691
|
return key === void 0 ? [] : [key];
|
|
13582
13692
|
});
|
|
13693
|
+
var askKey = (who, memberId) => "threadId" in who || memberId === void 0 ? recipientKey(who) : `${recipientKey(who)}#member:${memberId}`;
|
|
13583
13694
|
var actorKey = (principal) => {
|
|
13584
13695
|
const who = recipientOf(principal);
|
|
13585
|
-
return who === void 0 ? void 0 :
|
|
13696
|
+
return who === void 0 ? void 0 : askKey(who, principal.memberId);
|
|
13586
13697
|
};
|
|
13587
13698
|
var fresh = (at) => ({ since: at });
|
|
13588
13699
|
var later = (a, b) => b !== void 0 && Date.parse(b) > Date.parse(a) ? b : a;
|
|
13589
13700
|
function foldProgress2(state, event) {
|
|
13590
|
-
const decoded = decodeWorkEvent(event);
|
|
13701
|
+
const decoded = decodeWorkEvent(asItemComment(event));
|
|
13591
13702
|
if (Option_exports.isNone(decoded)) return state;
|
|
13592
13703
|
const work = decoded.value;
|
|
13593
13704
|
const { projectId, workItemId } = work.payload;
|
|
@@ -13672,8 +13783,15 @@ function startProgressCheckinRuntime(ctx, goals, wakes, now3 = factTime) {
|
|
|
13672
13783
|
const progress = ctx.derivedState({
|
|
13673
13784
|
key: "progress-checkin",
|
|
13674
13785
|
// 3:钟只记起算时间,成员自己的动作与插件的问话另记,指派给项目成员的钟按成员号记(问话时才解析执行者)。
|
|
13675
|
-
|
|
13676
|
-
|
|
13786
|
+
// 4:工作项上的发言当评论折(0112 U6e),已落盘的发言要重折。
|
|
13787
|
+
version: 4,
|
|
13788
|
+
events: [
|
|
13789
|
+
"work.item-created",
|
|
13790
|
+
"work.item-updated",
|
|
13791
|
+
"work.item-claimed",
|
|
13792
|
+
"work.comment-posted",
|
|
13793
|
+
"communication.post-sent"
|
|
13794
|
+
],
|
|
13677
13795
|
init: () => ({}),
|
|
13678
13796
|
apply: foldProgress2
|
|
13679
13797
|
});
|
|
@@ -13690,26 +13808,31 @@ function startProgressCheckinRuntime(ctx, goals, wakes, now3 = factTime) {
|
|
|
13690
13808
|
if (waitingOnSomeone(execution)) return false;
|
|
13691
13809
|
return !(execution.session.activeTurnId === null && (item.lastCommenter === recipientKey({ threadId }) || execution.summary.queue.length > 0));
|
|
13692
13810
|
};
|
|
13693
|
-
const remoteReady = async (item, principalId) => {
|
|
13811
|
+
const remoteReady = async (item, principalId, memberId) => {
|
|
13694
13812
|
const pending = await ctx.work.remoteAgentPending.get({
|
|
13695
13813
|
projectId: item.projectId,
|
|
13696
|
-
principalId
|
|
13814
|
+
principalId,
|
|
13815
|
+
...memberId === void 0 ? {} : { memberId }
|
|
13697
13816
|
});
|
|
13698
13817
|
return pending.wakes.count === 0;
|
|
13699
13818
|
};
|
|
13700
13819
|
let mountedAt = 0;
|
|
13701
|
-
const ask = async (item, who, clock, at) => {
|
|
13702
|
-
const
|
|
13703
|
-
const
|
|
13704
|
-
const
|
|
13705
|
-
|
|
13820
|
+
const ask = async (item, who, memberId, clock, at) => {
|
|
13821
|
+
const target = "threadId" in who ? void 0 : who.memberId ?? memberId;
|
|
13822
|
+
const identity2 = askKey(who, target);
|
|
13823
|
+
const machine = recipientKey(who);
|
|
13824
|
+
const sharedAsks = identity2 === machine ? [] : item.asks[machine] ?? [];
|
|
13825
|
+
const since = later(
|
|
13826
|
+
later(clock.since, item.acted[identity2]),
|
|
13827
|
+
identity2 === machine ? void 0 : item.acted[machine]
|
|
13706
13828
|
);
|
|
13829
|
+
const asked = [...item.asks[identity2] ?? [], ...sharedAsks].filter((time) => Date.parse(time) > Date.parse(since)).toSorted();
|
|
13707
13830
|
if (asked.length >= PROGRESS_CHECKIN_LIMIT) return;
|
|
13708
13831
|
const from = Date.parse(asked.at(-1) ?? since);
|
|
13709
13832
|
const counted = Math.max(from, mountedAt);
|
|
13710
13833
|
const queued = "threadId" in who ? capacity.waitedWithin(who.threadId, counted, at) : 0;
|
|
13711
13834
|
if (at - counted - queued < PROGRESS_CHECKIN_MINUTES * 6e4) return;
|
|
13712
|
-
const ready = "threadId" in who ? await localReady(item, who.threadId) : await remoteReady(item, who.principalId);
|
|
13835
|
+
const ready = "threadId" in who ? await localReady(item, who.threadId) : await remoteReady(item, who.principalId, target);
|
|
13713
13836
|
if (!ready) return;
|
|
13714
13837
|
const key = stableHash(
|
|
13715
13838
|
`${item.projectId}
|
|
@@ -13718,13 +13841,17 @@ ${identity2}
|
|
|
13718
13841
|
${since}
|
|
13719
13842
|
${asked.length}`
|
|
13720
13843
|
);
|
|
13721
|
-
await ctx.
|
|
13844
|
+
await ctx.communication.posts.send({
|
|
13722
13845
|
projectId: item.projectId,
|
|
13723
|
-
workItemId: item.workItemId,
|
|
13846
|
+
to: { workItemId: item.workItemId },
|
|
13724
13847
|
requestId: `team-progress-checkin:${key}`,
|
|
13725
|
-
|
|
13848
|
+
text: PROGRESS_CHECKIN_TEXT,
|
|
13726
13849
|
mentions: [
|
|
13727
|
-
"threadId" in who ? { kind: "
|
|
13850
|
+
"threadId" in who ? { kind: "thread", environmentId: ctx.environment.id, threadId: who.threadId } : {
|
|
13851
|
+
kind: "principal",
|
|
13852
|
+
principalId: who.principalId,
|
|
13853
|
+
...target === void 0 ? {} : { memberId: target }
|
|
13854
|
+
}
|
|
13728
13855
|
]
|
|
13729
13856
|
});
|
|
13730
13857
|
};
|
|
@@ -13770,7 +13897,8 @@ ${asked.length}`
|
|
|
13770
13897
|
continue;
|
|
13771
13898
|
if ("threadId" in who && !summaries.has(who.threadId))
|
|
13772
13899
|
summaries.set(who.threadId, await sampleCapacityWait(ctx, capacity, who.threadId, at));
|
|
13773
|
-
|
|
13900
|
+
const memberId = member.startsWith(MEMBER_PREFIX) ? member.slice(MEMBER_PREFIX.length) : members.get(member)?.memberId;
|
|
13901
|
+
await ask(item, who, memberId, clock, at).catch((error) => {
|
|
13774
13902
|
ctx.log.warn("team progress check-in failed", {
|
|
13775
13903
|
workItemId: item.workItemId,
|
|
13776
13904
|
member,
|
|
@@ -15144,7 +15272,7 @@ function teamLeadBrief(team) {
|
|
|
15144
15272
|
LEAD_PROGRESS_SUMMARY_RULE,
|
|
15145
15273
|
LEAD_SCHEDULE_CHECKIN_RULE,
|
|
15146
15274
|
LEAD_WORKTREES_KEPT_RULE,
|
|
15147
|
-
team.room === void 0 ? "The person is in this conversation: ask them directly in your replies. Use send_message only for people who are not in it. Put progress, updates and technical problems
|
|
15275
|
+
team.room === void 0 ? "The person is in this conversation: ask them directly in your replies. Use send_message only for people who are not in it. Put progress, updates and technical problems on the work items with send_message (to: { workItemId })." : `The person may speak to you in this conversation, and also in ${home}. Put progress, updates and technical problems on the work items with send_message (to: { workItemId }).`,
|
|
15148
15276
|
"If the work item tools are unavailable, tell the user directly that this project needs the board and project memory switches turned on first."
|
|
15149
15277
|
].join("\n\n");
|
|
15150
15278
|
}
|